Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
Java Program Assignment: TimePeriod and ParkingTariff classes

Exercise 1

Assignment Instructions

This assignment involves building, testing and debugging Java programs, that create and manipulate composition of classes that model simple types of object; and that employ the full gamut of implementing technologies: fields, constructors, methods and access modifiers.

Exercise 1

Your first task is to develop a TimePeriod class of object that meets the following specification

How are you to evaluate your work? There are two possibilities: (i) write a test program, or (ii) use the jGrasp interactive feature.

Exercise 2

Your next task is to develop a ParkingTariff class. The primary objective is actually to develop a TariffTable, however, there’s a design issue that must be solved first.
A TariffTable must store a series of parking tariffs. Each is an association between a time period and a cost. You could implement a TariffTable by using two arrays, one containing TimePeriod objects and the other containing Money objects, where the TimePeriod at index i in the first array is associated with the Money object at index I in the second array.

That’s not a particularly nice solution since there’s nothing in the resulting variable declarations to indicate the relationship, and there’s potential for mismatch. A better solution is to have a TariffTable contain a collection of ParkingTariff objects, where each ParkingTariff object stores a TimePeriod and Money.

Develop a ParkingTariff class of object.

• Your class will have instance variable(s), constructor(s), and method(s).
• You should aim to move beyond simple get and set methods to ones that offer greater functionality.

Exercise 4

The CarParkSim class contains the main program method. It creates the Register, Clock and TariffTable objects, and handles user input/output.

Extending the CarParSim solution that you constructed for the previous assignment, you need to:

• Add code to create and populate a TariffTable object.
• Extend the code for the ‘depart’ command to include printing the tariff that applies to a stay of that duration.
• Add code for an additional ‘tariffs’ command: When the user enters the ‘tariffs’ command, a list of parking tariffs will be printed.

support
close