Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am having issues printing the display from the staff and manager can you please assist? public abstract class Cisco { private String phone; private

I am having issues printing the display from the staff and manager can you please assist?

public abstract class Cisco { private String phone; private int phonemodel; public Cisco (String phone, int phonemodel) { this.phone = phone; this.phonemodel = phonemodel;} public String getPhone() { return phone;} public int getPhoneModel() { return phonemodel;} public void setPhone(String phone) { this.phone = phone;} public void setPhoneModel(int phonemodel) { this.phonemodel = phonemodel;} //Override public abstract String phone();}

-----------------------------------------------------------------------------------------------------------------------------------------------------------

public class Staff extends Cisco {

private int cost = 0; public Staff(String phone, int phonemodel, int cost) { super(phone, phonemodel); this.cost = cost;} public int getCost() { return cost;} public void setCost(int cost) { this.cost = cost;}

public String toString() { String display = "Welcome aboard staff member! Here is the style of phone you will recieve. "+ getPhone() + " : " + getPhoneModel() + " Please take care of it!"; return display;} //override public String phone() { String money = "The total cost of the new phone is: $" + getCost() ; return money;}

}

--------------------------------------------------------------------------------------------------------------------------------------------------------

public class Manager extends Cisco {

private int cost = 0; public Manager(String phone, int phonetype, int cost) { super(phone, phonetype); this.cost = cost;} public int getCost() { return cost;} public void setSelection(int cost) { this.cost = cost;} public String toString() { String display = "Welcome to the Managment team! Here is the style of phone you will recieve. "+ getPhone() + " : " + getPhoneModel() + " Please take care of it!"; return display;} //override public String phone() { String money = "The total cost of the new phone is: $" + getCost() ; return money;}

}

---------------------------------------------------------------------------------------------------------------------------------------------------------

import java.util.Scanner;

public class Ciscotest {

public static void main(String[] args) {

Scanner scan = new Scanner(System.in); String userSelection;

System.out.println("Please make the proper selection to figure out what phone you will receive:"); System.out.print("Please enter Yes or NO Are you a manager for the company:"); userSelection = scan.next();

if (userSelection == "Yes") { staff = new Staff("Cisco", 7841, 375);}

else if (userSelection == "No") { manager = new Manager("Cisco", 7841, 698);}

// displays System.out.println(staff); System.out.println(manager);}

}

I cant get it to print from the if-else statement. It is probably something dumb I am missing.

Thank you

Step by Step Solution

3.35 Rating (130 Votes )

There are 3 Steps involved in it

Step: 1

The issue in your code lies within the comparison of strings using the operator ... blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java How To Program Late Objects Version

Authors: Paul Deitel, Deitel & Associates

8th Edition

0136123716, 9780136123712

More Books

Students also viewed these Programming questions

Question

How else might employees be motivated to improve their performance?

Answered: 1 week ago