Making use of proper overloaded class constructors

Assignment Help Business Management
Reference no: EM131214976

Create a class named Vehicle that acts as a superclass for vehicle types. The Vehicle class contains private variables for the number of wheels and the average number of miles per gallon (MPG). For each of these variables - create the proper get and set methods. The Vehicle class also contains a constructor with integer parameters for the number of wheels and average MPG. Create two subclasses, PassengerCar and Truck that extend the Vehicle class. The PassengerCar class will have an additional field fuelTankCapacity and the method MaximumDistanceDriven, which calculate the maximum ride distance using the proper MPG and fuel tank capacity values. The Truck class has the additional cargoLoad field. Each subclass contains a constructor that accepts the MPG value and forces the number of wheels to the appropriate values - 4 for a PassengerCar and 8 for a Truck. The PassengerCar constructor also accepts fuel tank capacity value, and the Truck constructor accepts the cargo load value. All classes contain appropriate get and set methods for each newly added field.

Write a UseVehicles class to instantiate three objects making use of proper overloaded class constructors: one object of the Vehicle class, one object of the PassengerCar class and one object of the Truck class. When doing so, accept the user input and provide proper values for each the fields of each object (use Scanner of JOptionPane classes to implement a user's input).

Display the content of every data field in the newly created object: the number of wheels and average number of miles per gallon values for the Vehicle object; the number of wheels, miles per gallon, fuel tank capacity and maximum distance driven for a passenger car; number of wheels, average number of miles per gallon and cargo capacity for a Truck object.

Reference no: EM131214976

Questions Cloud

Starting the project initiation and planning process : As the Systems Analyst, you are starting the Project Initiation and Planning process.  You want to pull your team together so that you are all on the same page as to what this process involves.
Write a formal memorandum to the ceo of the corporation : Write a formal memorandum to the CEO of the corporation, including your analysis of the issue and explaining any recommendation you may have to correct the problem and to prevent its re-occurrence in the future.
Write a matlab program to calculate the probability : Write a MATLAB program to calculate the probability.- Note you will have to specify the mean and variance of the Gaussian random variable.
Needs of the employees and yourself : Restrict your company's rank-and-file employees to using the Internet only during regular working hours (9am to 5pm, five days a week). However, as network administrator, you want to be able to access the network at any time of the day or night, s..
Making use of proper overloaded class constructors : Write a UseVehicles class to instantiate three objects making use of proper overloaded class constructors: one object of the Vehicle class, one object of the PassengerCar class and one object of the Truck class. When doing so, accept the user inpu..
How can you implement doubly linked list : How can you implement doubly linked list? Write an algorithm for the doubly linked list.
Plot the relationship between hpr and changes in the ytm : Suppose you decide to invest in treasury bond GSBK39 for 5 years. Assume coupons can be reinvested at the current YTM of the bond, compute your holding period return (HPR) p.a. Plot the relationship between HPR and changes in the YTM
Researching wan connectivity options : Research major wide area networking (WAN) technologies and protocols that allow for the connecting and transfer of data between remote sites.
Write a matlab program to calculate the probability : Write a MATLAB program to calculate the probability if is a Gaussian random variable for an arbitrary a  and b > 0 Note you will have to specify the mean and variance of the Gaussian random variable.

Reviews

Write a Review

Business Management Questions & Answers

  Early assignments on the first job

Suggest some ways in which newly graduated engineers can "make their mark" in early assignments on the first job.

  Despite of cooperation in early time and numerous lawsuits

Despite of the cooperation in early time and numerous lawsuits in past few years, it seems that the competition between Samsung and Apple will never come to an end.

  How much circuit-breaker relief are they eligible

a. What property tax would they pay without circuit-breaker relief? b. For how much circuit-breaker relief are they eligible?

  Discuss single important lesson entrepreneur should apply

Reflecting back on everything you have learned in this course, discuss the single most important lesson any entrepreneur should apply in order to be successful. Explain your rationale.

  Case study of performance managementquestionreview case1

case study of performance managementquestionreview case1. evaluate the mission and vision statements of pepsico against

  Complexity of business decision making in course

Primary Task Response: Within the Discussion Board area, write 300-600 words that respond to the following questions with your thoughts, ideas, and comments. This will be the foundation for future discussions by your classmates. Be substantive and..

  Explain what is the key objective for google

Explain what is the KEY objective for Google and Wegmans Food Stores and how is pay used to drive those objectives?

  Determine average daily credit sales

Miranda Tool Corporation sells to retail hardware stores on credit terms of "net 30." Yearly credit sales are $18 million and are spread evenly during the year.

  Networking and collaboration allow people to telecommute

Networking and collaboration allow people to telecommute, and several studies and anecdotal reports show that telecommuters often are more productive than in-house staff and they tend to be more satisfied with their jobs.

  Memorandums and email messages

what circumstance you would use one over the other. You may of course include an illustration to support your analysis.

  Advocating for public health policy

Imagine that you have been chosen to represent a public health advocacy group as they begin a campaign to get legislation related to a health issue passed in your state legislature. You have been tasked with the role of presenting a proposed polic..

  Identify a business theorist and their theory

Summarize the company's industry, how long they have been in business, and the attribute they are the least admired for. Identify a business theorist and their theory. Investigate the government regulations associated with the industry (for in..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd