idol tanong lang, may bridging program ba sa sti?, ung iba strand mo pero pwede ka kumuha kahit anong course?
diko alam yan boss pero puwede ka naman kumuha ng kahit anong course sa college kahit ano pa strand mo
Hello! I'm here to help you with your coding issue. To properly assist you, could you please provide the code that you are currently working on? You mentioned that the name is not displaying. By looking at the screenshot you attached, I can help you check if the code is correct and if it follows the instructions given. Let's work together to solve this problem.
// main
import java.util.Scanner;
public class RunEmployee {
public static void main(String[] args) {
String worktype;
Scanner sc = new Scanner (System.in);
Employee Pol = new Employee();
FullTimeEmployee Ftime = new FullTimeEmployee();
PartTimeEmployee Ptime = new PartTimeEmployee();
System.out.print("Enter name: ");
Pol.setName(sc.nextLine());
System.out.print("Enter F for Full Time or P for Part Time: ");
worktype = sc.nextLine();
if (worktype.equalsIgnoreCase("P")){
System.out.print("Enter rate per hour and no. of hours worked separated by space: ");
Ptime.setRatePerHour(sc.nextDouble ()); Ptime.setHoursWorked(sc.nextInt());
System.out.println("Name:" + Ptime.getName());
System.out.println("Wage: " + Ptime.getWage());
}
else if (worktype.equalsIgnoreCase("F")){
System.out.println("Enter Monthly Salary :");
Ftime.setMonthlySalary(sc.nextDouble());
System.out.println("Name: " + Ftime.getName());
System.out.println("Wage: " + Ftime.getMonthlySalary());
}
}
}
//super class
public class Employee {
private String name;
void setName (String name){
this.name = name;
}
String getName(){
return name;
}
}
//subclass
public class FullTimeEmployee extends Employee {
private double monthlySalary;
void setMonthlySalary(double monthlySalary){
this.monthlySalary = monthlySalary;
}
double getMonthlySalary(){
return monthlySalary;
}
}
//2ndsubclass
public class PartTimeEmployee extends Employee {
private double ratePerHour;
private int hoursWorked;
private double wage;
void setWage (double wage){
this.ratePerHour = ratePerHour;
this.hoursWorked = hoursWorked;
}
double getWage(){
wage = ratePerHour * hoursWorked;
return wage;
}
void setRatePerHour (double ratePerHour){
this.ratePerHour = ratePerHour;
}
double getRatePerHour(){
return ratePerHour;
}
void setHoursWorked(int hoursWorked){
this.hoursWorked = hoursWorked;
}
int getHoursWorked(){
return hoursWorked;
}
}