0% found this document useful (0 votes)
2 views6 pages

Good Programming

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views6 pages

Good Programming

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd

Assignment -2

Name-Farhan Siddiqui

Solution-1
Code from line 1 to 30

Code line 30 to 55
output
Solution-2
public class Employee

public int EmpID; { get; set; }

public int DeptID; { get; set; }

public string Name ; get; set; }

public int AgeInYrs; { get; set; }

public class Department extends Employee

public int DeptID; { get; set; }

public string DeptName; { get; set; }

public List<Employee> employee { get; set; }

public class Supervisor extends Employee

public int SuperVisorName;{ get; set;}

public int DeptID; { get; set;}

public class Subordinates extends Employee


{

public void Engineer();

public void [Link]();

Solution-3

import [Link];
//Program to calculate discount on food

public class Discount {


public static void main(String[] args) {
String type;
Scanner scanner = new Scanner([Link]);
double amount;
int cartValue;
int itemNo;
double discount;

String grade;

[Link]("Enter Customer grade : \r [Link] \[Link] \[Link] customer \


[Link]\r [Link] ");
[Link]("Choose any no.");
grade = [Link]();
[Link]("Enter the amount");
amount = [Link]();
double discount1=(double)amount*2/100;
switch (grade) {
case "1":
[Link]("Enter type of customer");
type = [Link]();
if ([Link]("gold")) {
discount = (double) (amount * 10) / 100;
amount = amount - discount-discount1;
[Link]("Total amount is " + amount);
} else if ([Link]("silver") && amount > 1000) {
discount = (double) (amount * 7) / 100;
amount=amount-discount-discount1;
[Link]("Total amount is " + amount);
}
break;
case "2":
String coupon_code;
[Link]("Enter coupon code");
coupon_code = [Link]();
if (amount >= 2000 && coupon_code.equalsIgnoreCase("Enjoy500")) {
amount = amount - 500;
[Link]("Total amount is " + amount);
} else
[Link]("Total amount is " + amount);
break;
case "3":
discount = (double) (amount * 7) / 100;
if (discount > 500) {
amount = amount - 500;
[Link]("Total amount is " + amount);
} else {
amount = amount - discount;
[Link]("Total amount is " + amount);
}
break;
case "4":
String bankName;
[Link]("Enter Bank Name");
bankName = [Link]();
if ([Link]("StanC") && amount >= 1000) {
discount = (double) (amount * 30) / 100;
amount = amount - 250;
[Link]("Total amount is " + amount);
} else
[Link]("Total amount is " + amount);
break;
case "5":
[Link]("Enter No of item : ");
itemNo = [Link]();
if (amount >= 200 && itemNo >= 3) {
amount = amount - (double) (amount * 25 / 100)-discount1;
}
else if (amount >= 200) {
amount = amount - (double) (amount * 5 / 100)-discount1;
}
else if (itemNo >= 3) {
amount = amount - (double) (amount * 20 / 100)-discount1;
}
[Link](amount);

break;
default:
[Link]("Invalid Error");

}
}
}

You might also like