Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Computer Science Object Oriented Programming Question 3.13 (Invoice Class) Create a class called Invoice that a hardware store might use to represent an invoice for

Computer Science Object Oriented Programming Question

image text in transcribed

3.13 (Invoice Class) Create a class called Invoice that a hardware store might use to represent an invoice for an item sold at the store. An Invoice should include four data members-a part num- ber (type string), a part description (type string), a quantity of the item being purchased (type int) and a price per item (type int). [Note: In subsequent chapters, we'll use numbers that contain decimal points (e.g., 2.75)-called floating-point values-to represent dollar amounts.) Your class should have a constructor that initializes the four data members. A constructor that receives multiple arguments is defined with the form: ClassNameC TpeNamel parameterNamel, TpeName2 parameterName2, ) Provide a set and a get function for each data member. In addition, provide a member function named getInvoiceAmount that calculates the invoice amount (i.e., multiplies the quantity by the price per item), then returns the amount as an int value. If the quantity is not positive, it should boe set to o. If the price per item is not positive, it should be set to o. Write a test program that demon- strates class Invoice's capabilities. 3.14 (Employee Class) Create a class called Employee that includes three pieces of information as data members-a first name (type string), a last name (type string) and a monthly salary (type int). [Note: In subsequent chapters, we'll use numbers that contain decimal points (e.g, 2.75)- called floating-point values-to represent dollar amounts.] Your class should have a constructor that initializes the three data members. Provide a set and a get function for each data member. If the monthly salary is not positive, set it to 0Write a test program that demonstrates class Employee's capabilities. Create two Employee objects and display each object's yearly salary. Then give each Em- ployee a 10 percent raise and display each Employee's yearly salary again. 3.15 (Date Class) Create a class called Date that includes three pieces of information as data members-a month (type int), a day (type int) and a year (type int). Your class should have a con- structor with three parameters that uses the parameters toi purpose of this exercise, assume that the values provided for the year and day are correct, but ensure that the month value is in the range 1-12; if it isn't, set the month to 1. Provide a set and a get func- tion for each data member. Provide a member function displayDate that displays the month, day nitialize the three data members. For the and year separated by forward slashes). Write a test program that demonstrates class Date's capa- ties

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_2

Step: 3

blur-text-image_3

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 10 High Performance Expert Techniques For Query Optimization High Availability And Efficient Database Maintenance

Authors: Ibrar Ahmed ,Gregory Smith ,Enrico Pirozzi

3rd Edition

1788474481, 978-1788474481

More Books

Students also viewed these Databases questions

Question

5. Give some examples of hidden knowledge.

Answered: 1 week ago