Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3 . 1 0 ( Sct and Get Functions ) Explain why a class inighe provide a set function and a get function for a
Sct and Get Functions Explain why a class inighe provide a set function and a get function for a data memberModifying Class GradeBook Modify class GradeBook Pigs as follows:a Include a second string data member that represents the course instructor's name.b Provide a set function to change the instructor's name and a get function to recrieve itc Modity the constructor to specify course nanic and instructor name parameters.d Modify function displayMessage to output the welcome message and course name, then the string. "This course is presented by: followed by the instructor's name.Use your modified class in a test program that demonstrates the class's new capabilities:Account Class Create an Account class that a bank might use to represent customers bank accounts. Include a data member of type int to represent the account balance. Note; In subsequent chapters, well use numbers that contain decimal points eg called floatingpoint values to represent dollar amounts. Provide a constructor that reccives an initial balance and uses it to initialize the data member. The consuructor should validate the inirial balance to ensure that it's greater than or equal to If not, set the balance to arid display an error message indicating that the initial balance was invalid. Provide three member functions. Member function credit should add an amount to the current balance. Member function debit should withdraw money from the Account and ensure chat the debit amount does not exceed the Account's balance. If it does, the balance should be left unchanged and the tunction should print a message indicating "Debit amount exceeded account balance." Member function getBalance should return the current balance. Create a program that creates rwo Account objeces and tests the member functions of class AccountInvoice Class Create a class called Invotce that a hardhvare store might use to represent an invoice for an item sold at the store. An Invoice should include four data members a pat number type string a part description type string a quantity of the item being purchased type int and price per item type intNete: In subsequent chapters, we'll use numbers that contain decimal points eg: called floatingpoint values to represent dollar amounts. Your class should have a constructor that initializes the four data members. A constructor that receives multiplearguments is defined with the form:Class Name TypeNamel parameter Namel, Spellamel parameter Namel;..Provide a set and a get function. for each data member. In addition, provide a member function named getInvoiceAnount that calculates the invoice amount Le multiplies the quantity by the price per item, then returns the amount as an int value. If the quantity is not positive, it should be set to If the price per item is not positive, it should be set to Write a test program that demonstrates class Invoices capabilitiesEsployee Class Create a class called Employee that includes three pieces of information as dara membersa first name type string a last name type string and a monthly salary typeintNote: In subsequent chapters, well use numbers that contain decimal points egcalled floatingpoint 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 Write a test program that demonstrates class Employee's capabilities: Create two Employee objeets and display each object's yearly salary. Then give each Employee a percent raise and display each Employee'S yearly salary againDate Class Create a class called Date that includes three pieces of information as data membersa month type int a day type int and a year cype int Your class should have a constructot with three parameters that uses the parameters to initialize the three data members. For the purpose of this exercise, assume that the values provided for the year and day are correct, but ensure that che month value is in the range if it isn't, set the month to T Provide a set and a ger func dion for each data member. Provide a member function displayDate that displays the month, day
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started