Create a class called invoice that a hardware store may use

Assignment Help JAVA Programming
Reference no: EM13809949

Create a class called Invoice that a hardware store may use to represent an invoice for an item sold at the store.  The class should have four (4) instance variables: 

  • part number : string
  • part description : string (what is the item)
  • quantity being purchased : int
  • price per item : double

Create a constructor that initializes the four data members.  Also use default parameters with your constructor.  Create an accessor and mutator for each data member as well.  

Create a member function named getInvoiceAmount that calculates the invoice amount. If the quantity is less than 0, it should be set to 0. If the price per item is also negative, that should be set to 0 as well.

You may create a function that dsplays the receipt.

For extra credit, write a method to overload the ostream and istream operators so any object of the class can be displayed in a cout statement and the object values can be inputted using cin.  E.g.

Invoice i;

cin >> i;

cout << i;

Reference no: EM13809949

Questions Cloud

Scalation of addictive behaviors : scalation of addictive behaviors
Determining the inventory management costs : Safety Firms Inc. sells photographic products using an (R,S) type of control system. SFI is considering investing in a scanner such that they can move from an (R,S) type to an (R,Q) inventory policy. It is expected that with a continuous review po..
Event introducing local meeting planners : You work for an event planning company and you are planning an event introducing local meeting planners to free and easy-to-use technology to incorporate into their meetings.
Discuss the major corporate-level strategy formulation : Discuss the major corporate-level strategy formulation responsibilities.  How are they different from business-level strategy formulation responsibilities?
Create a class called invoice that a hardware store may use : Create a class called Invoice that a hardware store may use to represent an invoice for an item sold at the store.  The class should have four (4) instance variables: part number : string and part description : string (what is the item)
Define the sarbanes-oxley act : The Sarbanes-Oxley Act is intended to increase the confidence of the public and investors through increasing which of the following?
The effects of an unhealthy family system on development : Discuss the effects of an unhealthy family system on development
Show that kirchhoffs voltage and current law : Provide a description of the method that was used to analyze the first circuit - Use the data collected in the second table to show that Kirchhoff's Voltage and Current Law were satisfied.
Evaluating various types of risk : The following Discussion Board task will assist you in evaluating various types of risk. Research at least 2 sources (which may include your textbook) to support your response.

Reviews

Write a Review

 

JAVA Programming Questions & Answers

  Describe the swing applet life cycle

Describe the swing applet life cycle. Create a swing applet that displays the date and time in a JTextField with the JLabel "Today is" when the user clicks a JButton

  Write a method called add uneven arrays

Write a method called addUnevenArrays that takes two arrays, a and b, and returns a new array, c, with alength that is the maximum of the lengths of a and b. Each c[i] is the sum of the corresponding elementsof a and b if both elements exist.

  Java program by array

Write a program that reads in a file that contains one integer per line. Each integer represents one location in the image. Assume that there are 64 rows and 64 columns in the image

  Create a class named blooddata

Create a class named BloodData that includes fields that hold a blood type (the four blood types are O, A, B, and AB) and an Rh factor

  Finally make a java test class in your test class you must

finally create a java test class. in your test class you should at a minimum a construct 200 instances of each subclass

  Design and develop a console application

Required to design and develop a console (text-based) application for a small car servicing company -

  Be sure to show all declarations

Write a function call that invokes function a. Be sure to show all declarations. However a complete main is not required.

  Error conditions as compared to using exception handling

What are the advantages and disadvantages of testing for error conditions as compared to using exception handling when performing input or output?

  Automated code coverage and cyclomatic complexity analyses

Automated code coverage and cyclomatic complexity analyses -

  Rna hairpins and mirror box drawings

When the program starts up, it should draw a vertical line from the top of the screen to the bot- tom that cleanly divides the window in half. This makes it easier for the user to see the mirror effect.

  Create a program using a gui interface

In your lab5 folder, compile the file that is a starting point for this assignment. The listing and image of this Java class is on the bottom of this lab description. You can create the programs by cutting and pasting.

  The string class and/or the stringbuffer class in java

Create a simple Java application that uses the String class and/or the StringBuffer class and at least 4 of the class methods. Show the code, demonstrate it works properly and describe what it is doing.

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