Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Homework Help/Study Tips Expert

Aim

The aim of this assignment is to create a class to represent a car at a local car dealership, together with two subclasses to represent a car to buy and a car to rent respectively. You will also need to write a report about your program. You are advised to study the learning aid on reflective practice, which is linked from the module in WebLearn. Your report should be no more than 1200 words in length (excluding the table of contents, class diagram and code listing).

Program

The program should consist of the following classes (with no additional attributes or methods).

1) The Car class has two attributes, which correspond to the description and the customer's name. The description and the customer's name are each represented as a string of text. The description is initialised in the constructor, by being assigned the value of the constructor's only parameter. The customer's name is assigned an empty string ("").

Each attribute has a corresponding accessor method and there is another method to set the customer's name to a new name. A display method will output (suitably annotated) the description and, if the customer's name is not an empty string, the customer's name too.

2) The CarToBuy class is a subclass of the Car class and it has four attributes:

price a whole number
registration year a whole number
mileage a whole number
sold true or false

The constructor accepts four parameters, which are the description, the price, the registration year and the mileage. A call is made to the superclass constructor with one parameter, the description. The price, registration year and mileage attributes are given the corresponding parameter values. Additionally, the constructor initialises sold to false.

Each attribute has a corresponding accessor method.

A method is required to set the price as changes to the price inevitably occur. The method accepts a new price as a parameter and, if the car already been sold, a suitable message is output to the user indicating that it is therefore not possible to change the price. Otherwise, the new value is assigned to the price attribute.

There is a method for buying the car. The method has one parameter, the customer's name and, if the car already been sold, a suitable message is output to the user indicating that it is therefore not possible to sell it. Otherwise, the method to set the customer's name is called with the customer's name as a parameter and sold is set to true.

A method to display the details of the car is required. It must have the same signature as the display method in the Car class. It will call the method in Car class to display the description and, if applicable, the customer name. If the car has not been sold then the price, registration year and mileage must also be displayed. Each output must be suitably annotated.

3) The CarToRent class is also a subclass of the Car class and has seven attributes:

rental date a string of text
return date a string of text
admin fee a whole number 
number of days a whole number 
daily rate a whole number 
total accumulated a whole number 
on loan either true or false

Whenever the car is rented, the amount that the customer pays is calculated by multiplying the daily rate by the number of days and then adding the admin fee. The total accumulated represents the total amount paid by all customers to date.

The constructor accepts three parameters, which are the description, the admin fee and the daily rate. A call is made to the superclass constructor with one parameter, the description. The admin fee and daily rate attributes are assigned the corresponding parameter values and the rental date and return date are each

initialised to an empty string. Also in the constructor, the number of days and the total accumulated are each initialised to 0 and the attribute indicating whether the car is on loan is initialised to false.

Each attribute has a corresponding accessor method.

A method is required to set the daily rate as changes to the rate inevitably occur. The method accepts a new daily rate as a parameter and assigns that value to the daily rate attribute.

A method is required to set the admin fee as changes to that also occur. The method accepts a new admin fee as a parameter and assigns that value to the admin fee attribute.

There should be a method to rent the car. The method accepts, as parameters, the customer's name, the rental date, the return date and the number of days the car is required. If the car is already on loan, an appropriate error message including the return date is output to the customer. Otherwise, the rental date, the return date and the number of days are all updated by the input parameter values, the method to set the customer's name is called with the customer's name as a parameter, the attribute indicating whether the car is on loan is changed to true and the amount paid by the customer is added to the total accumulated.

There should be a method for returning the car to the rental company. If the car is on loan, the method to set the customer's name is called with an empty string as a parameter, the number of days is set to 0, the date of hire and the date of return are each set to empty strings and the loan status is set to false. Otherwise, a suitable error message is output.

There should be a method to print the description of the car together with its total accumulated, suitably annotated. (To access the description, the method to get the description must be called.)

A method to display the details of the car is required. It must have the same signature as the display method in the Car class. It will call the method in Car class to display the description and, if applicable, the customer's name. The method should then display the admin fee and the daily rate. If the car is on loan then the rental date, the return date and the number of days should also be displayed. Each output must be suitably annotated.

Report

A class diagram showing the inheritance relationship between the three classes and, for each class, the name of the class, the data types and names of the fields and the return types and signatures of the methods

A short description of what each method does

You should give evidence (through appropriate screenshots) of the following testing that you carried out on your program:

Test 1: Inspect a car to buy, buy the car, re-inspect the car to buy

Test 2: Display all the details of a car to buy

Test 3: Inspect a car to rent, rent the car, re-inspect the car to rent

Test 4: Display the description and total accumulated, before and after renting the car

Test 5: Display all the details of a car to rent

Test 6: Inspect a car to rent, return the car, re-inspect the car to rent

The report should contain a section on error detection and error correction where you give examples and evidence of three errors encountered in your implementation. The errors (syntax and/or runtime) should be distinctive and not of the same type.

The report should contain a conclusion, where you evaluate your work, reflecting on what you learnt from the assignment. You are advised to study the learning aid on reflective practice, which is linked from the module in WebLearn.

The report should include a title page (including your name and ID number), a table of contents (with page numbers), and a listing of the code (in an appendix). Marks will also be awarded for the quality of writing and the presentation of the report.

Homework Help/Study Tips, Others

  • Category:- Homework Help/Study Tips
  • Reference No.:- M92563142
  • Price:- $35

Priced at Now at $35, Verified Solution

Have any Question?


Related Questions in Homework Help/Study Tips

Assignment biocentric ethics and preserving speciesplease

Assignment : Biocentric Ethics and Preserving Species Please read the introduction to Chapter 5. Please read my summary of Taylor's views that I put on the assignment page at the top. Read the following two articles. (Re ...

Assignmentin the summer of 2011 texas faced the worst

Assignment In the summer of 2011, Texas faced the worst drought in modern history. This natural disaster caused widespread destruction and collateral damage brought about by forces other than the acts of human beings. Li ...

Question introduction to management information systemsread

Question: Introduction to Management Information Systems Read at least three (3) academically reviewed articles on Management Information Systems and complete the following activities: Discuss at least 3 different concep ...

Software engineering methodologies assignment - formal

Software Engineering Methodologies Assignment - Formal System Specification Overview - The purpose of this assessment is to provide students with the opportunity to apply knowledge and skills developed during the semeste ...

Question the story of the immigrant workers in out of this

Question: The story of the immigrant workers in Out of This Furnace is an example of the triumph of industrial democracy (defined as a combination of economic democracy and political democracy) during Americans industria ...

Leading lean projects assessment - case study continuous

Leading Lean Projects Assessment - Case study: Continuous Improvement Introduction - Precision Engineering Works Private Limited (PEW) is an original equipment manufacturer specialising in plastic moulding parts for the ...

Since the client is a painter the visual and communication

"Since the client is a painter, the visual and communication tests are valid for this assessment." Which specific three subtests from the WAIS-IV do you recommend to assess visual and communication skills? After you sele ...

The frontal lobe controls higher order cognitive functions

The frontal lobe controls "higher order" cognitive functions, like complex perception, judgment, abstract thinking and the like, that all play a role in how we perceive/interpret images. What do you think of the role of ...

Question submit a powerpoint presentation based on four

Question: Submit a PowerPoint Presentation based on four different conflicts you have encountered. These conflicts can be work related or personal conflicts. The presentation will consist of 5 slides and must have at lea ...

Question why the new schoolthe new school brings together a

Question: Why The New School? The New School brings together a dynamic group of students interested in art, design, performing arts, entrepreneurship, and critical thought. We would like to know more about your interest ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As