Write an application containing a main method

Assignment Help JAVA Programming
Reference no: EM131299469

Write a Java program that meets the following requirements:

A. Create a class named "Invoice" that holds an invoice numner, balance due, and three fields representing the month, day and year when the balance is due. Create a constructor that accepts values for all five data fields. Within the constructor, assign each argument to the appropriate field with the following exceptions:

·If an invoice number is less t han 1000, force the invoice number to 0.
·If the month field is less than 1 or greater than 12, force the month field to 0.
·If the day field is less than 1 or greater than 31, force the day field to 0.
·If the year field is less than 2011 or greater than 2017, force the year field to 0.

In the "Invoice" class, include a display method that displays all the fields on an Invoice object. Save the file as "Invoice.java".

B. Write an application containing a main() method that declares several Invoice objects, proving that all the statements in the constructor operate as specified. Save the file as "TestInvoice.java".

C. Modify the constructor in the Invoice class so that the day is not greater than 31, 30, or 28, depending on the month. For example, if a user tries to create an invoice for April 31, force it to April 30. Also, if the month is invalid, and thus forced to 0, also force the day to 0. Save the modified Invoice class as Invoice2.java. Then modify the TestInvoice class to create Invoice2 objects. Create enough objects to test every decision in the constructor. Save this file as "TestInvoice2.java".

Purpose:

Create a java program from detailed directions.

Ability to:

Follow established programming conventions for writing java programs
Create a class
Instantiate an object
Create a constructor to override the default constructor
Able to write nested IF statements
Use the print statement for output.

Reference no: EM131299469

Questions Cloud

Write a short paragraph of three correct sentences : Write a short paragraph of three correct sentences (NB: using ONLY your own sentences) for each of the following sets of words. Principal (adjective) and principle (noun). Dependent and dependant
Display a frequency chart for each exam score in the array : Create a Java application that contains methods to display statistics for the numbers in an array. Receive the array as an argument and display a frequency chart for each exam score in the array.
Standard deviations of the distributions : The standard deviations of the distributions of b2 and b3 for the 10 million samples in Figure 3.5 are both 0.45. Verify that this is what you would expect theoretically, given that the correlation between X2 and X3 is 0.9962 and that S22 = 665 an..
What advantages do they hold over their competitors : What companies or organizations in the Kingdom of Saudi Arabia have been rethinking their markets and what advantages do they hold over their competitors?
Write an application containing a main method : Write an application containing a main() method that declares several Invoice objects, proving that all the statements in the constructor operate as specified. Save the file as "TestInvoice.java".
What is the minimum value of the convection heat transfer : what is the minimum value of the convection heat transfer coefficient expressed in terms of the sphere diameter and thermal conductivity of the air?
Identify the errors in the php code provided : Identify the errors in the PHP code provided for you in assignment6.php (Download ZIP). Correct the code and create comments explaining why the original code would not work properly.
Lifetime budget constraint of the consumer : 1) Write down the lifetime budget constraint of the consumer. 2) Show that lifetime wealth is the same for the consumer, before and after the change in tax rates.
Why the teller application can call the withdraw methods : Explain why the Teller application can call the withdraw and deposit methods using a SavingsAccount object reference, even though we did not define these methods.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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