❓ Help Mga paps pa help sa oop

Panto

Honorary Poster
mga boss pa help bat ayaw mag display ng name? dina kaya ng utak ko kahit anong gawing explore ko e saka pa check narin po if tama yung code ko naka follow ba sa instructions nasa baba po pic
IMG_20240308_004332_300.webp
IMG_20240308_004349_432.webp
IMG_20240308_004356_333.webp
IMG_20240308_004404_021.webp
IMG_20240308_004427_237.webp
Screenshot_20240308-005107.webp
 
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.
 
idol tanong lang, may bridging program ba sa sti?, ung iba strand mo pero pwede ka kumuha kahit anong course?
 
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;
}





}
 
Sa baba ng "Enter name"
String name = sc.nextLine();
Ftime.setName(name);
Ptime.setName(name);

Dapat dun sa RunEmployee (Main class)
Actually, no use si Pol na diyan eh dahil parent class mo na yan sa FTE at PTE.
Set the values dun sa child class ni Employee
 
Sa baba ng "Enter name"
String name = sc.nextLine();
Ftime.setName(name);
Ptime.setName(name);

Dapat dun sa RunEmployee (Main class)
Actually, no use si Pol na diyan eh dahil parent class mo na yan sa FTE at PTE.
Set the values dun sa child class ni Employee
okay na paps nag ask ako kay gpt same logic lang sayo kaso ginamit niya pa pol kaya ayun na submit ko btw thanks at least alam kona now puwede pala ganyan
 

About this Thread

  • 6
    Replies
  • 548
    Views
  • 3
    Participants
Last reply from:
Panto

Trending Topics

Online now

Members online
1,068
Guests online
946
Total visitors
2,014

Forum statistics

Threads
2,273,644
Posts
28,950,684
Members
1,234,902
Latest member
LEVIISS
Back
Top