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

  Explain the legal doctrine benefits balancing

Explain the legal doctrine "Benefits Balancing" as it pertains to applying the reasonable standard of care doctrine in the medical fields. Does a defense that the majority of physicians normally do not give a particular diagnostic test in the normal ..

  Design a course registration system

Create an application which represents a simplified course registration system using ArrayLists and HashMaps.

  Write java program to reads ten values from user

Write the java program which reads 10 values from user and store them in 1 daimantion array. your program will ask the user wich operation he wants to perform:

  What is an infinite loop

What is an "off-by-one error"? Give an example for it from your experience.What is an infinite loop? Write a for statement to demonstrate it.

  Program produces 1000 integer ranging

Then your program produces 1000 integer ranging from 1to 10000 in the array and then sort them in ascending order and then print the result into data.txt file. (You may list integers separated by space or new line)

  Write a thread function to initialize 2d array

write a thread function to initialize int 2D array x (NxN) so that each thread initializes its portion with i+j in each slot. Note that i and j relate to the entire array.

  Common to perform loops that vary the loop control

When an application contains an array and you want to use every element of the array in some task, it is common to perform loops that vary the loop control variable from 0 to one less than the size of the array.

  Create the java code for a generic class

Create the Java code for a generic class. The class should contain at least one private data member of a generic type, a constructor which initializes the private data member to the value of a passed in argument, and a getter and setter for the ge..

  Write an if statement that uses the flag as the condition

Write an if statement that uses the flag as the condition. Remember that the flag is a Boolean variable, therefore is true or false. It does not have to be compared to anything.

  The program should ask the user to enter the student'' answer

Your program should store these correct answers in an array. (Store each question's correct answer in an element of a string array.) the program should ask the user to enter the student's answers for each of the 20 questions, which should be stored i..

  Define a car structure type

For this assignment you will write a program that determines which of a set of rental cars the user can rent for a user-specified rental rate. The rental car data is contained in a text file which will be fed into your program using stdin redirect..

  Process of identifying classes or functions for replacement

A 700- to 1050-word paper describing the following: How the two programs were selected and The process of identifying the classes or functions for replacement

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