Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE WRITE IN JAVA Write a class named Bill with the following specifications: - The class contains three fields, one of type int named number,

PLEASE WRITE IN JAVA image text in transcribed
Write a class named Bill with the following specifications: - The class contains three fields, one of type int named number, one of type String named name, and one of type double named amount. - The class contains one constructor which has parameters for all fields. The constructor should set the values of the fields to the values passed to its parameters. - The class should contain another constructor which has only one parameter for the name field. The constructor should set the value of the name field to the value passed to its parameter. The constructor should set the number field to 999. The constructor should set the value of the amount field to 0.0. - The class contains get and set methods for each field. - The class contains a toString() method that returns a String that contains information about the value of all fields. Double values should be rounded to two decimal places. - The class contains a method named calculateTax with return type double and one parameter of type double named percentage. The method should return the value of the amount field multiplied by the value of percentage. Write another class named TestBill with the following specifications: - The class contains a main() method. - The class creates two Bill objects each using a different constructor. - The class uses two System.out.printin() statements to print the objects without using the get methods. - The class should call the calculatefax method for both objects and print the results to the screen. Late Submissions Policy: Problems not submitted by the deadline will be penalized by 10% with an additional 10% penalty added for each 24 hour period elapsed between the original deadline and time of submission

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

4. Did you rethink your decision?

Answered: 1 week ago