Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Program : Vehicle Registration Program using netbeans .java

This program will be used to calculate vehicle registration fees. It will include a Vehicle parent class, a Car subclass, and a Calculate interface that is implemented by the Car class. The steps are outlined below.

1. Write an interface called Calculate that includes one method - calcFee - that will calculate the registration fee for a vehicle. calcFee returns a float and doesn't take any parameters.

2. Create a class called Vehicle. This class contains the following attributes:

owner (String)
regNumber (int)

The Vehicle class contains methods to set/get owner and regNumber. Its constructor should initialize all variables to 0 or "" (depending on type). Vehicle will have subclasses.

3. Create a subclass of Vehicle called Car that implements the Calculate interface. Car should have additional attributes of:

make (String)
model (String)
regType (String - values will be either "new" or "renew")
regFee (float)

In addition to the get/set methods for make, model, and regType, include the method calcFee, to calculate the registration fee according to the following conditions:

if regType = renew, then the fee is $36
else if regType = new, then the fee is $58.50

NOTE: To compare two strings in Java, use the "equals" method rather than ==; e.g., if (string1.equals(string2))

When getting input from the user using sc.nextInt() (this assumes that you named your Scanner object "sc"), there will be a newline left in the buffer. Simply put the statement sc.nextLine() after your sc.nextInt() statement to clear the newline from the buffer.

4. In your main class for the program, create a car object called myCar (be sure and include make, model, and registration type [either new or renew] in the constructor call statement). Get the following input from the user:

owner name
registration number
make
model
registration type

Calculate the registration fee, then display the owner name, registration number, registration type, and registration fee.

NOTE: The following statement will print the result of the calcFee() method with two decimal places (and go to a new line):

System.out.format("Amount: $ %.2f%n", myCar.calcFee());

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93093777

Have any Question?


Related Questions in Computer Engineering

Question suppose a process ie parent forks a child process

Question : Suppose a process (i.e., parent) forks a child process using resource sharing such that the parent and child share all resources. Does this include the Process Control Block and memory space or does the child ...

Suppose that on your birthday you checked the balance on

Suppose that on your birthday you checked the balance on your retirement account and you decided to make a $1,000 payment at the end of every month until you retire at the specified age. If you disreagard the inflation ( ...

Research the differences in file formats between ms office

Research the differences in file formats between MS Office 2003 and MS Office 2007. Explain how file signatures and metadata can be used to determine which versions of MS Office applications (e.g. Word, Excel, Power Poin ...

Question please read this instruction and section 5 and 6

Question: Please read this instruction, and section 5 and 6 in particular, CAREFULLY as it affects all future programming assignments. 1. Setup Android Studio Development Environment 1.1 Download necessary packages using ...

Do a search for how to write a for-loop in r practice some

Do a search for how to write a for-loop in R. Practice some simple examples from the internet. Then use a for-loop to calculate the alternating sum of the first 100,000 digits of pi. That is, calculate the sum 3 - 1 + 4 ...

Question a student study 0 1 2 or 3 hours for a math 307

Question : A student study 0, 1, 2, or 3 hours for a MATH 307 test on any given day. Use the tree diagram to find the total number of ways in which the student can study at most 4 hours for the test on two consecutive da ...

You have 2 tasks to createer-modeling in ms visio simple

You have 2 tasks to createER-Modeling in MS visio. Simple jab for the database expert that would take him 30 min to finish. My requirement not only for the expert to get the task done. I need to do it myself. Then he cor ...

We live in kapurkua a small island in the mediterranean

We live in Kapurkua, a small island in the mediterranean between Greece and Spain (no, it doesn't really exist so don't look it up in the map). In the island we produce and consume canoes, latreks (a garment that is comf ...

You are putting together a trip to kamino to pick up clones

You are putting together a trip to Kamino to pick up clones and need to take a group of droids along to help. You have 11 droids from which to select, and decide to take 4. How many different groups of droids could you t ...

Suppose you have the new zarnex vq-120 computer which has a

Suppose you have the new Zarnex VQ-120 computer which has a 64-bit architecture. Further, the boss has told you to ‘‘max out the memory,'' which, on that machine, means you can install all the memory the architecture sup ...

  • 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