CODER
CODER
double calculateDeductions() {
return sssDeduction + taxDeduction +
pagibigDeduction + philhealthDeduction;
}
@Override
void displayPayslip(){}
@Override
void displayPay() {
double totalSalary = calculateTotalSalary();
double totalDeductions =
calculateDeductions();
double netPay = totalSalary - totalDeductions;
System.out.println("Name: " + name);
System.out.println("Employee Number: " +
employeeNumber);
System.out.println("TIN: " + TIN);
System.out.println("Basic Salary: " +
basicSalary);
System.out.println("Incentives:");
System.out.println("Internet: " +
internetAllowance);
System.out.println("Transport: " +
transpoAllowance);
System.out.println("Rice Allowance: " +
riceAllowance);
System.out.println("Total Salary: " +
totalSalary);
System.out.println("\nDeductions:");
System.out.println("SSS: " + sssDeduction);
System.out.println("Tax: " + taxDeduction);
System.out.println("Pag-ibig: " +
pagibigDeduction);
System.out.println("PhilHealth: " +
philhealthDeduction);
System.out.println("Total Deductions: " +
totalDeductions);
System.out.println("\nyour amount: " +
netPay);
}
}
package main; System.out.println("Name: " + name); 8
abstract class Employe { System.out.println("Employee Number: " +
employeeNumber);
protected String name;
System.out.println("TIN: " + TIN);
protected String employeeNumber;
System.out.println("Basic Salary: " + basicSalary);
protected String TIN;
System.out.println("Incentives:");
protected final double basicSalary = 20000;
System.out.println("Internet: " + internetAllowance);
public Employe(String name, String
employeeNumber, String TIN) { System.out.println("Transport: " +
transpoAllowance);
this.name = name;
System.out.println("Rice Allowance: " +
this.employeeNumber = employeeNumber;
riceAllowance);
this.TIN = TIN;
System.out.println("Total Salary: " + totalSalary);
}
System.out.println("\nDeductions:");
abstract double calculateTotalSalary();
System.out.println("SSS: " + sssDeduction);
abstract double calculateDeductions();
System.out.println("Tax: " + taxDeduction);
abstract void displayPayslip();
System.out.println("Pag-ibig: " + pagibigDeduction);
abstract void displayPay();
System.out.println("PhilHealth: " +
} philhealthDeduction);
void displayPay(){} }
@Override @Override
if (again.equals("yes")) {
System.out.print("Name: ");
System.out.print("TIN: ");
System.out.println("\n----------------------------");
emp2.displayPay();
} else if (again.equals("no")) {
System.out.println("Thank you!");
break;
} else {
scanner.close();
}
}
7
case 2: }
paymentMethod = "Card Payment"; }
break; package main;
default: public class room {
System.out.println("Invalid input! Please try private String type;
again.");
private double price;
}
public room(String type, double price) {
}
this.type = type;
System.out.println("\nPayment Method: " +
this.price = price;
paymentMethod);
}
System.out.println("Thank you for staying with us!
Come back again!"); public double getPrice() {
return price;
scanner.close(); }
} public String getType() {
return type;
public static room selectRoom(Scanner scanner) { }
room room = null; }
while (room == null) { class KingRoom extends room {
System.out.println(" Welcome to my hotel public KingRoom() {
");
super("King Room", 15000.00);
System.out.println("Select a room type:");
}
System.out.println("1. Regular Room (Php3500)");
}
System.out.println("2. Family Room (Php10000)");
class FamilyRoom extends room {
System.out.println("3. King Room (Php15000)");
public FamilyRoom() {
System.out.print("Enter choice: ");
super("Family Room", 10000.00);
int roomChoice = scanner.nextInt();
}
}
switch (roomChoice) {
class RegularRoom extends room {
case 1:
public RegularRoom() {
room = new RegularRoom();
super("Regular Room", 3500.00);
break;
}
case 2:
}
room = new FamilyRoom();
package main;
break;
public class Amenity {
case 3:
private String name;
room = new KingRoom();
private double price;
break;
public Amenity(String name, double price) {
default:
this.name = name;
System.out.println("Invalid input! Please try
again."); this.price = price;
} }
case 1: case 2:
break; break;
case 3: case 1:
break; break;
public Drinks(String name, double price, int package main; 6
quantity) {
public class Desserts {
this.name = name;
private String name;
this.price = price;
private double price;
this.quantity = quantity;
private int quantity;
}
public Desserts(String name, double price, int
public void display() { quantity) {
System.out.println(quantity + "x " + name + " - " + this.name = name;
computeTotal());
this.price = price;
}
this.quantity = quantity;
public double computeTotal() {
}
return price * quantity;
public void display() {
}
System.out.println(quantity + "x " + name + " - " +
public int getQuantity() { computeTotal());
return quantity; }
} public double computeTotal() {
} return price * quantity;
}
package main; public int getQuantity() {
public class Foods { return quantity;
private String name; }
private double price; }
private int quantity;
public Foods(String name, double price, int quantity)
{
this.name = name;
this.price = price;
this.quantity = quantity;
}
public void display() {
System.out.println(quantity + "x " + name + " - " +
computeTotal());
}
public double computeTotal() {
return price * quantity;
}
public int getQuantity() {
return quantity;
}
}
private static Drinks getDrinkChoice(Scanner scanner) { return scanner.nextInt(); 6
while (true) { }
try {
6
package main; case 0:
switch (choice) { }
case 1: }
food = getFoodChoice(scanner);
}
4 } else { package main; 5
} else if (age >= 40 && age <= 55) { selectedAccount = new acc("\nYunna Labbao",
"July 9, 2007", 8652, 73619, "Yunna", "07526",
System.out.println("Age Group: Middle
"[email protected]", 1200);
adulthood");
} else {
} else if (age >= 60 && age <= 70) {
System.out.println("No fund user with this
System.out.println("Age Group: Old
account number.");
Person");
return;
} else {
}
System.out.println("Age Group:
Unidentified"); System.out.println("\nAccount Details:");
} System.out.println(selectedAccount);
} while (true) {
System.out.println("\nSelect a Transaction:");
} System.out.println("4. Close/Exit");
System.out.print("Enter your choice: ");
4
System.out.print("\nWould you want to select another System.out.println("Diagnosis: " + diagnosis);
patient? (yes/no): ");
System.out.println("Type of Room: " + roomType);
van.nextLine();
System.out.println("Number of Hours: " + hours);
String again = van.nextLine().toLowerCase();
}
if (!again.equals("yes")) {
System.out.println("Thank you!");
void Category() {
break;
if (hours >= 1 && hours <= 2) {
}
System.out.println("Category 1: Self-care (1 to 2
} hours per day)");
} else if (hours >= 3 && hours <= 4) {
van.close(); System.out.println("Category 2: Minimal care (3
to 4 hours)");
}
} else if (hours >= 5 && hours <= 6) {
}
System.out.println("Category 3: Intermediate
care (5 to 6 hours)");
package main;
} else if (hours >= 7 && hours <= 8 {
System.out.println("Category 4: Modified
import java.util.Scanner; intensive care (7 to 8 hours)");
} else if (hours <= 10) {
this.contactPerson = contactPerson;
this.diagnosis = diagnosis; int rate = roomType.equalsIgnoreCase("Private") ?
1000 : 400;
this.roomType = roomType;
int totalCost = rate * hours;
this.hours = hours;
}
if (isDiscounted.equals("yes")) {
double discount = totalCost * 0.20;
void displayDetails() {
double discountedCost = totalCost - discount;
System.out.println("\nDetails about the Patient:");
System.out.println("\nBill per hour: " + rate + "
System.out.println("Name: " + name);
PHP");
System.out.println("Age: " + age);
System.out.println("Discount: " + discount + "
System.out.println("Address: " + address); PHP");
this.ratings = ratings;
this.genre = genre;
String director,
System.out.print("\nChoose a patient use the
String ratings, (Patient Code): ");
String genre, int choice = van.nextInt();
String character,
}
3
package main; case 5:
import java.util.Scanner; Employeee e5 = new Employeee("\nFruit
Basket", "Yoshihide Ibata", "5/5", "Animation", "Tohru,
public class Main {
Yuki, Kyo, Akito\n");
public static void main(String[] args) {
displayMovieDetails(e5);
Scanner scanner = new Scanner(System.in);
break;
while (true) {
case 6:
System.out.println("\nTICKET FOR Movie");
Employeee e6 = new Employeee("\nThe
System.out.println("SELECT Movie:"); Kingdom", "Michael Tuviera", "5/5", "Drama\n");
System.out.println("1. Coco"); displayMovieDetails(e6);
System.out.println("2. Jumanji"); break;
System.out.println("3. Hunter x Hunter"); default:
System.out.println("4. Black Clover"); System.out.println("Invalid choice.");
System.out.println("5. Fruit Basket"); }
System.out.println("6. The Kingdom"); System.out.print("\nDo you want to choose
another movie? (yes or no): ");
System.out.print("\nEnter the Movie number (1-
6): "); scanner.nextLine();
int movieNumber = scanner.nextInt(); String choice = scanner.nextLine();
switch (movieNumber) { if (choice.equalsIgnoreCase("No")) {
case 1: System.out.println();
Employeee e1 = new Employeee("\nCoco", System.out.println(" Thank you for
"Lee Unkrich", "5/5", "Action", "mama coco, ernesto, reviewing. \n Exiting...");
tia rosita", "2017", "PG\n");
Break;
displayMovieDetails(e1);
} else if (choice.equalsIgnoreCase("Yes")) {
break;
System.out.println("\n Select another movie.\
case 2: n");
Employeee e2 = new Employeee("\ } else{
nJumanji", "Jake Kasdan", "5/5", "Adventure", "Dr.
System.out.println("\n Invalid! pls Repeat.");
Smolder, Ruby, Bethany, Spencer", "2017", "PG\n");
}
displayMovieDetails(e2);
}
break;
}
case 3:
private static void displayMovieDetails(Employeee
Employeee e3 = new Employeee("\nHunter
movie) {
x Hunter", "Hiroshi Kōjina", "5/5", "Suspense", "Killua,
Gon, Hisoka, Kurapika", "2011", "SPG\n"); System.out.println("\nTitle: " + movie.TITLE);
displayMovieDetails(e3); System.out.println("Director: " + movie.director);
break; System.out.println("Ratings: " + movie.ratings);
case 4: System.out.println("Genre: " + movie.genre);
Employeee e4 = new Employeee("\nBlack System.out.println("Characters: " +
Clover", "Tatsuya Yoshihara", "5/5", "Fantasy", "Asta, movie.character);
Noelle, Yami, Julius", "2020", "SPG\n");
System.out.println("Year: " + movie.year);
displayMovieDetails(e4);
System.out.println("SPG: " + movie.SPG);
break;
}
}
2
import java.util.Scanner; int finalPrice = price;
public class Main { if (vipChoice.equals("yes")) {
public static void main(String[] args) { finalPrice += 200;
Scanner scanner = new Scanner(System.in); }
if (choice < 1 || choice > MovieNames.length) { UIFruits(String concertName, int price, String time,
String date) {
System.out.println("Invalid choice.");
this.concertName = concertName;
return;
this.price = price;
}
this.time = time;
String MovieName = MovieNames[choice - 1];
this.date = date;
int price = prices[choice - 1];
}
String time = times[choice - 1];
void displayDetails() {
String date = dates[choice - 1];
System.out.println("Movie: " + concertName);
}
System.out.print("\nIf you want VIP? (yes or no): ");
}
String vipChoice = scanner.next().toLowerCase();