Using replit.com: Your code for this question must be a complete program that successfully compiles. Write...
Fantastic news! We've Found the answer you've been seeking!
Question:
![image text in transcribed](https://s3.amazonaws.com/si.experts.images/answers/2024/05/66448ac8e51bc_00866448ac8a3303.jpg)
Transcribed Image Text:
Using replit.com: Your code for this question must be a complete program that successfully compiles. Write an abstract class Machine, which has three private class variables: machineName (string), machineID (int), and numberOfMachines (int). numberOfMachines is a static variable that is initialized with the value zero (0) and is incremented by one (1) each time an object is created. The class should have an overloaded constructor, which takes in one parameter, name (string), and assigns it to the variable machineName. The constructor also increments by one (1) the value of numberOfMachines and assigns its incremented value to the variable machineID. The class should also create a getter method for the variable machineName. Write a concrete class Tractor, which inherits Machine. Tractor should have one class variable, horsePower (int), and an overloaded constructor, which takes in two parameters, name (string) and power (int). The first parameter, name (string), is assigned to the variable machineName in the Machine class via a call to the Machine class overloaded constructor (i.e. using constructor chaining). The second parameter, power (int), is assigned to the variable horsePower. The class should also create a getter method for the variable horsePower. Write a concrete class Computer, which inherits Machine. Computer should have one variable, processorSpeed (double), and an overloaded constructor, which takes in two parameters, name (string) and speed (double). The first parameter, name (string), is assigned to the variable machineName in the Machine class via a call to the Machine class overloaded constructor (i.e. using constructor chaining). The second parameter, speed (double), is assigned to the class variable processorSpeed. The class should create a getter method for the variable processorSpeed. In your main method, create two objects. Create a Tractor object with a name of "John Deere 6R" and a horsepower of 110. Create a Computer object with a name of "MacBook Pro 13" and a processorSpeed of 1.8. For the Tractor object, print its name and horse power. For the Computer object, print its name and processor speed. Paste (ctrl v) your completed code from replit.com into this box: Using replit.com: Your code for this question must be a complete program that successfully compiles. Write an abstract class Machine, which has three private class variables: machineName (string), machineID (int), and numberOfMachines (int). numberOfMachines is a static variable that is initialized with the value zero (0) and is incremented by one (1) each time an object is created. The class should have an overloaded constructor, which takes in one parameter, name (string), and assigns it to the variable machineName. The constructor also increments by one (1) the value of numberOfMachines and assigns its incremented value to the variable machineID. The class should also create a getter method for the variable machineName. Write a concrete class Tractor, which inherits Machine. Tractor should have one class variable, horsePower (int), and an overloaded constructor, which takes in two parameters, name (string) and power (int). The first parameter, name (string), is assigned to the variable machineName in the Machine class via a call to the Machine class overloaded constructor (i.e. using constructor chaining). The second parameter, power (int), is assigned to the variable horsePower. The class should also create a getter method for the variable horsePower. Write a concrete class Computer, which inherits Machine. Computer should have one variable, processorSpeed (double), and an overloaded constructor, which takes in two parameters, name (string) and speed (double). The first parameter, name (string), is assigned to the variable machineName in the Machine class via a call to the Machine class overloaded constructor (i.e. using constructor chaining). The second parameter, speed (double), is assigned to the class variable processorSpeed. The class should create a getter method for the variable processorSpeed. In your main method, create two objects. Create a Tractor object with a name of "John Deere 6R" and a horsepower of 110. Create a Computer object with a name of "MacBook Pro 13" and a processorSpeed of 1.8. For the Tractor object, print its name and horse power. For the Computer object, print its name and processor speed. Paste (ctrl v) your completed code from replit.com into this box:
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
4. Find the expected value, standard deviation and variance for the data below. Prob Rx Ry 20% 9.00 9.65 30%-5.00 -4.00 25% 8.50 12.50 25% 8.00 9.57
-
Lab 2: Exceptions/Sorting This lab has two parts, with no real connection between them. The first part of the lab asks you to find out how long it takes to sort a large array using both a sorting...
-
Complete class diagram (phase 5 and 6). 17 Questions. 17 To be submitted: 18 Marking Criteria. 20 Appendix A: Sample Output for a completed phase 6. 22 Objectives In this assignment you will develop...
-
The inequality describes the range of monthly average temperatures T in degrees Fahrenheit at a certain location. (a) Solve the inequality. (b) If the high and low monthly average temperatures...
-
Answer true or false to each statement, and give reasons for your answers. a. If event A and event B are mutually exclusive, so are events A, B, and C for every event C. b. If event A and event B are...
-
The frequency of the note F 4 is 349 Hz. (a) If an organ pipe is open at one end and closed at the other, what length must it have for its fundamental mode to produce this note at 20.OoC? (b) At what...
-
Why is a linear programming model useful in solving the product mix problem?
-
Calder, Inc. is a furniture manufacturing company with 50 employees. Recently, after a long negotiation with the local labor union, the company decided to initiate a pension plan as a part of its...
-
3. [5 points] Deux variables alatoires discrtes, X et Y, ont la distribution conjointe suivante X 0 1 2 3 1 0,05 0,18 0,13 0,07 Y 2 0,09 0,14 0,08 0,06 3 0,11 0,03 0,04 0,02 a) Calculer la probabilit...
-
A 14-in.-diameter circular plate is placed over a fixed bottom plate with a 0.1-in. gap between the two plates filled with glycerin as shown in the figure below. Determine the torque required to...
-
As a class, discuss the following questions: a. Did the questions you asked provide you with the information you had hoped for? b. Discuss at least one response that you found surprising or...
-
In January last year, Penny planned a holiday to Africa for her extended family, in celebration of her grandmother's 70th birthday. Her grandmother loves watching nature documentaries, and Penny was...
-
Using the information below Describe one decision making model.Making decisions follows a systematic approach of determining the outcomes expected/desired, setting criteria to ensure that the...
-
Sandstone Corporation has the following account balances and respective fair values on June 30: Items Receivables Patented technology Computer software In-process research and development Liabilities...
-
Miller Company's contribution format Income statement for the most recent month is shown below: Total Per Unit Sales (25,800 units) Variable expenses $ 232,200 139,320 $ 9.00 5.40 Contribution margin...
-
Toby wants to perform some CVP analysis on fertilizing jobs. On one job, she used 40 pounds of fertilizer that she bought in bulk ($1,000 for 2,000 pounds). It took her employee 1.5 hours to spread...
-
What is an insurable interest? Why is it important?
-
Many organizations talk about the need to be collaborative and work as a team. What changes would be necessary in an organizations human resources systems to reinforce teamwork?
-
How would you respond to a professor who was initially very inclusive and encouraging but later became more demanding?
-
What are the activities or interests that take up most of your time?
![Mobile App Logo](https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png)
Study smarter with the SolutionInn App