ven the following class definition: class employee { public: employee(); employee(string, int, double); employee(int, double); employee(string); void setData(string, int, double); void print() const; void updatePay(double); int getNumOfServiceYears() const;
Q: public class Date { privateintyear; privateintmonth; privateintday; public Date() {…
A: The task requires creating three static methods in the Driver class: displayMenu(),…
Q: package myq2; class Sale { int sellerID, milksale, buttersale; Sale(int sid, int ms, int bs) {…
A: The problem is based on the basics of classes in java programming language.
Q: StringInstrument.java // TODO: Define a class: StringInstrument that is derived from the Instrument…
A: import java.util.Scanner; public class InstrumentInformation { public static void main(String[]…
Q: public class Student { private String name; private String major; privatedoublegpa;…
A: To fix the main method so it does not print out the memory location, you need to modify the way the…
Q: What would be best way to use LocalDate for needsMaintenance if the aircrafts last mainenace date is…
A: For the needsMaintenance method, you can use LocalDate to calculate the date that is three months…
Q: class Course { private String courseNumber; private String courseName; private int…
A: Introduction class Course { private String courseNumber; private String courseName;…
Q: The base class Pet has protected fields petName, and petAge. The derived class Cat extends the Pet…
A: The main() method of a program that makes instances of the Pet and Cat classes and prints their…
Q: In C++ class film { public: void setFilmDirector(string s); //sets the filmTitle to s…
A: In the given code printAllFilmInfo() prints the information about each film object…
Q: public class Stadium extends baseStadium{ public int typeTicket; int floors; int seating;…
A: The code includes three classes: Stadium, ticket, and baseStadium, and one interface TicketService.…
Q: 26. Assume the declaration of Exercise 24. A. Write the staternents that derive the class dummyClass…
A: Dear Student, For inheritance we use the syntax - Class B extends A Here class B is the derived…
Q: private: int x, у;
A: Corrected Program: #include<iostream.h> #include<conio.h> class Point { private: int…
Q: Which of the following statements is TRUE in the context of the above Clone() method's code extract?…
A: The clone () technique does: The clone() mechanism is used to duplicate an individual of a Separate…
Q: Rubric: Correct the syntax and logical errors Proper working code
A: Correct java code: class SavingsAccount{ float interest; float fixedDeposit;…
Q: when printing Weigh no value shows up code public class HealthProfile { private String _FirstName;…
A: The problem is due to name resolution in the constructor,when we change it this it will work…
Q: //PLEASE CORRECT MY MISTAKES, THANK YOU public class Person { private String personID; private…
A: As per the question, solution is mentioned below:
Q: Implement the following class MyPhoneBook. You can add additional private member variables and…
A: Actually, program is an executable software that runs on a computer.
Q: class Player { protected: string name; double weight; double height; public:…
A: Note: since your question contain multiple subparts but we can answer only 3sub-parts at a time…
Q: class temporary { public: void set(string, double, double); void print(); double manipulate();…
A: Algorithm:Include necessary libraries:Include the required C++ libraries for input and output…
Q: public void addRoom (String type, double area) m rooms [m countRooms] m countRooms++; = new Room…
A: IN this question we have to demonstrate the relationship between the following classes in java.
Q: public class Person { private String personID; private String firstName; private String lastName;…
A: Your code is also correct but I have provided more efficient code below.
Q: What's the depth of inheritance for mobile phones? How many methods are overridden/overloaded…
A: As per our guidelines we are supposed to answer only 1st three parts. kindly repost the remaining…
Q: Given a base Plant class and a derived Flower class, complete main() to create an ArrayList called…
A: Algorithm:Create an empty ArrayList called myGarden to hold Plant or Flower objects.Initialize an…
Q: Public classTestMain { public static void main(String [ ] args) { Car myCar1,…
A: Solution: Given,
Q: class temporary { public: void set(string, double, double); void print(); double manipulate();…
A: Algorithm:Include necessary libraries:Include the required C++ libraries for input and output…
Q: Public Class SavingsAccount { float interest; float FixedDeposit; SeniorAccount(float…
A: A syntax error is the error in the program which is made typing mistakes by the user and logical…
Q: What is printed? public class Puppy { private int puppyAge; private String puppyName; Puppy(String…
A: The correct answer is : (d) Run time error
Q: Complete the Course class by implementing the printRoster() method, which outputs a list of all…
A: Create a Course object representing a course.Initialize variables first, last, and gpa to store…
Q: Given main() and a base Book class, define a derived class called Encyclopedia with member methods…
A: As per the given information, I need to provide the code for Encyclopedia class.Algorithm for…
Q: Class Quiz public Quiz (int quesList, int quesMissed) { quesList = this.quesList; quesMissed =…
A: To use scoreQuiz in passFailQuiz() method. Create getScoreQuiz() method. public int getScoreQuiz() {…
Q: Show StudentsADT interface
A: package xyz;public class Course { private String courseName;private String sectionNumber;private…
Q: class Vehicle private: int wheels; protected : int passenger: public : void inputdata(int, int);…
A: A class is a user-defined data type that consists of data members and member functions. The access…
Q: Question (2) Create a new package (employee2), solve the error and trace the output import…
A: Employee.java package employee;public class Employee{public StringfirstName,lastName;public int…
Q: This class includes a constructor that begins on line 8; however, it contains an error. Describe the…
A: The following code :public class Author2 {3 private String name;4 private int numberOfAwards;5…
Q: class Course { private String courseNumber; private String courseName; private int…
A: ArrayList is a kind of dynamic array for storing the elements i.e. an array with no size limit. It…
Q: ? int count; public: Category(string name, string code): name(name), code(code){} /* Implement the…
A: You need to implement count function and add function
Q: public class Person
A: Please find the improved solution below. The comments would be helpful in better understanding the…
Q: this is my retail item code: //Import statements public class RetailItem { private String…
A: In this programming scenario, tasked with creating a Java program that simulates a retail system.…
Q: class Base public: int x, y: public: Base(int i, int j) x = i; y = j; }}; class Derived : public…
A: OUTPUT screenshot:
Q: class Lease{ private String name; private int aptNumber; private double rent;…
A: class Lease{ private String name; private int aptNumber; private double rent; private…
Given the following class definition:
class employee
{
public:
employee();
employee(string, int, double);
employee(int, double);
employee(string);
void setData(string, int, double);
void print() const;
void updatePay(double);
int getNumOfServiceYears() const;
double getPay() const;
private:
string name;
int numOfServiceYears;
double pay;
};
Create a class parttime derived from the above class that includes private members payRate and hoursWorked of type double along with a constructor and the definition of a print function that prints out all information from the base and derived class. Provide a test program that would demonstrate the working parttime class.
Note: You can assume all code is stored in a single file.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- class Player { protected: string name; double weight; double height; public: Player(string n, double w, double h) { name = n; weight = w; height = h; } string getName() const { return name; } virtual void printStats() const = 0; }; class BasketballPlayer : public Player { private: int fieldgoals; int attempts; public: BasketballPlayer(string n, double w, double h, int fg, int a) : Player(n, w, h) { fieldgoals = fg; attempts = a; } void printStats() const { cout << name << endl; cout << "Weight: " << weight; cout << " Height: " << height << endl; cout << "FG: " << fieldgoals; cout << " attempts: " << attempts; cout << " Pct: " << (double) fieldgoals / attempts << endl; } }; a. What does = 0 after function printStats() do? b. Would the following line in main() compile: Player p; -- why or why not? c. Could…class Lease{ private String name; private int aptNumber; private double rent; private int term; private static final int FEE = 10; public Lease(){ name = "XXX"; aptNumber = 0; rent = 1000; term = 12; } public void setName(String tenant) { name = tenant; } public void setAptNumber(int apt){ aptNumber = apt; } public void setRent(double monthRent) { rent = monthRent; } public void setTerm(int t){ term = t; } public String getName(){ return name; } public int getAptNumber(){ return aptNumber; } public double getRent(){ return rent; } public int getTerm(){ return term; } public void addPetFee(){ rent = rent + FEE; } } Create a class named TestLease as instructed below: Instantiate four Lease objects in the main()method. Change the aptNumber value for the first object to 20 Change the rent value…class Course { private String courseNumber; private String courseName; private int creditHrs; public Course (String number, String name, int creditHrs){ this.courseNumber = number; this.courseName = name; this.creditHrs = creditHrs; } public String getNumber() { return courseNumber; } public String getName() { return courseName; } public int getCreditHrs() { return creditHrs; } public void setCourseNumber(String courseNumber) { this.courseNumber = courseNumber; } public void setCourseName(String courseName) { this.courseName = courseName; } public void setCreditHrs(int creditHrs) { this.creditHrs = creditHrs; }} class Student { private String firstName; private String lastName; private String gender; private String phoneNumber; private String email; private String jNumber; protected ArrayList<MyCourse> courseList; public String…
- class Course { private String courseNumber; private String courseName; private int creditHrs; public Course (String number, String name, int creditHrs){ this.courseNumber = number; this.courseName = name; this.creditHrs = creditHrs; } public String getNumber() { return courseNumber; } public String getName() { return courseName; } public int getCreditHrs() { return creditHrs; } public void setCourseNumber(String courseNumber) { this.courseNumber = courseNumber; } public void setCourseName(String courseName) { this.courseName = courseName; } public void setCreditHrs(int creditHrs) { this.creditHrs = creditHrs; }}class Student { private String firstName; private String lastName; private String gender; private String phoneNumber; private String email; private String jNumber; protected ArrayList courseList; public String getFullName() {…public class Book { protected String title; protected String author; protected String publisher; protected String publicationDate; public void setTitle(String userTitle) { title = userTitle; } public String getTitle() { return title; } public void setAuthor(String userAuthor) { author = userAuthor; } public String getAuthor(){ return author; } public void setPublisher(String userPublisher) { publisher = userPublisher; } public String getPublisher() { return publisher; } public void setPublicationDate(String userPublicationDate) { publicationDate = userPublicationDate; } public String getPublicationDate() { return publicationDate; } public void printInfo() { System.out.println("Book Information: "); System.out.println(" Book Title: " + title); System.out.println(" Author: " + author); System.out.println(" Publisher: " + publisher); System.out.println(" Publication…public class LabProgram { public static void main(String args[]) { Course course = new Course(); String first; // first name String last; // last name double gpa; // grade point average first = "Henry"; last = "Cabot"; gpa = 3.5; course.addStudent(new Student(first, last, gpa)); // Add 1st student first = "Brenda"; last = "Stern"; gpa = 2.0; course.addStudent(new Student(first, last, gpa)); // Add 2nd student first = "Jane"; last = "Flynn"; gpa = 3.9; course.addStudent(new Student(first, last, gpa)); // Add 3rd student first = "Lynda"; last = "Robison"; gpa = 3.2; course.addStudent(new Student(first, last, gpa)); // Add 4th student course.printRoster(); } } // Class representing a student public class Student { private String first; // first name private String last; // last name private double gpa; // grade point average…
- public class Person { private String personID; private String firstName; private String lastName; private String birthDate; private String address; public Person(){ personID = ""; firstName = ""; lastName = ""; birthDate = ""; address = ""; } public Person(String id, String first, String last, String birth, String add){ setPerson(id,first,last,birth,add); } public void setPerson(String id, String first, String last, String birth, String add){ personID = id; firstName = first; lastName = last; birthDate = birth; address = add; } public String getFirstName(){ return firstName; } public String getLastName(){ return lastName; } public String getBirthdate(){ return birthDate; } public String getAddress(){ return address; } public void print(){ System.out.print("\nPerson ID = " + personID); System.out.print("\nFirst Name = " +firstName); System.out.print("\nLast Name = " +lastName); System.out.print("\nBirth Date = " +birthDate); System.out.print("\nAddress = " +address); } public String…public class Person { private String personID; private String firstName; private String lastName; private String birthDate; private String address; public Person(){ personID = ""; firstName = ""; lastName = ""; birthDate = ""; address = ""; } public Person(String id, String first, String last, String birth, String add){ setPerson(id,first,last,birth,add); } public void setPerson(String id, String first, String last, String birth, String add){ personID = id; firstName = first; lastName = last; birthDate = birth; address = add; } public String getFirstName(){ return firstName; } public String getLastName(){ return lastName; } public String getBirthdate(){ return birthDate; } public String getAddress(){ return address; } public void print(){ System.out.print("\nPerson ID = " + personID); System.out.print("\nFirst Name = " +firstName); System.out.print("\nLast Name = " +lastName); System.out.print("\nBirth Date = " +birthDate); System.out.print("\nAddress = " +address); } public String…public class Application { public static void main(String[] args) { Employee empl = new Employee(); empl.firstName = "Ali"; empl.lastName = "Omar"; empl.salary = 20000; Employee emp2 = new Employee(); emp2.firstName = "Mohamed"; emp2.lastName = "Nour"; emp2.salary = 30000; System.out.println("- System.out.printin("- empl.employeeSalary(); System.out.println("- empl.checkEmployeeSalary(emp1.salary, emp2.salary); System.out.printin("- System.out.println("- printEmployee(emp2); System.out.printin("- Employee employeeArr[] = new Employee[2]: employeeArr[0] = empl; employeeArr[1] = emp2; Application a = new Åpplication(); a.printArrayofEmployee(employeeArr); Non static (instance) start to call Static function to print ---------"); "); - Non Static function to print - --"); Non static (instance) start to call same class Static function to print --------); -"); Non Static function to print ----); System.out.println("- System.out.printin("- System.out.printin("Salary : " + Employee.salary);…
- public class Aircraft { // instance vairables private String aircraftName; private String regNumber; private String manufacturer; privateintmaxRange; privateintcrewSize; private LocalDate yearPutInService; privateintmaxServiceWeight; privateintnumberOfPassengers; privateintcurrentAirMiles; private LocalDate lastMaintenanceDate; privateintlastMaintenanceMiles; /** * Default Constructor * * @param lastMaintenanceMiles * @param lastMaintenanceDate * @param totalMiles * @param model * @param manufacturer * @param regNumber * @param vehicleType */ public Aircraft(String aircraftName, String regNumber, String manufacturer, intmaxRange, intcrewSize, LocalDate yearPutInService, int maxServiceWeight, int numberOfPassengers, int currentAirMiles, LocalDate lastMaintenanceDate, int lastMaintenanceMiles) { { this.aircraftName = aircraftName; this.regNumber = regNumber; this.manufacturer = manufacturer; this.maxRange = maxRange; this.crewSize = crewSize; this.yearPutInService = yearPutInService;…class Vehicle { private: int wheels; protected : int passenger: public : void inputdata(int, int); void outputdata(); }; class Heavyvehicle : protected Vehicle { int diesel_petrol; protected : int load; public: void readdata(int, int); void writedata(); }; class Bus : private Heavyvehicle char make[20]; public : void fetchdata(char); void displaydata(); (1) Name the base class and derived class of the class Heavyvehicle. (ii) Name the data member(s) that can be accessed from function displaydata(). (iii) Name the data member's that can be accessed by an object of Bus class. (iv) Is the member function outputdata() accessible to the objects of Heavyvehicle class.public class Employee { } private String Name; private String Surname; private int Age; private String EmployeeNum; public Employee (String Name, String Surname, int Age) { this.Name = Name; this. Surname = Surname; this. Age Age; } public Employee Clone() { Employee copy = new Employee (this. Name, this. Surname, this.Age); return copy; }