Using the below provided class personType; create two other classes: bookClubMem
ID: 645543 • Letter: U
Question
Using the below provided class personType; create two other classes:
bookClubMember class
bookStoreEmployee class
For the bookClubMember class -- your class should be able to keep track of a member's name, member ID, and whether they have paid their membership fee, and their discount benefits. If they paid their membership fee their discount is set to 10% otherwise discount is set to 0%
For the bookStoreEmployee class - your class should be able to keep track of a employee's name, employee ID, number of hours they work in a week, their hourly rate, their gross pay and their take home pay. Take home pay is the amount the employee takes home after a 15% deduction (for various taxes etc) from their gross pay.
In int main() -- ask your user how many club members they have in the book store and how many employees they have in the book store. Then allow the user to create and set the data for the number of employees and club members and print that back to them.
For example:
How many book club members do you have at your store?
2
How many employees do you have?
2
What is club member 1's name:
John Smith
What is club member 1's ID:
1111
Have they paid their membership fee this month?
Yes
What is club member 2's name:
Jane Smith
What is club member 2's ID:
2222
Have they paid their membership fee this month?
No
What is employee 1's name:
Jackie Chan
What is employee 1's ID:
E111
What is employee 1's hourly rate:
10
How many hours did employee 1 work this week:
35
What is employee 2's name:
Lois Lane
What is employee 2's ID:
E222
What is employee 2's hourly rate:
15
How many hours did employee 2 work this week:
25
Here is your club member information:
John Smith 1111 10% Discount Good Standing
Jane Smith 2222 No Discount Not in Good Standing
Here is your employee information:
Jackie Chan E111 Gross Pay: $350.00 Take Home Pay: $297.50
Lois Lane E222 Gross Pay: $375.00 Take Home Pay: $318.75
**Copy all of your code to a word document along with screen captures of the working program -- place the word document in the dropbox under the Week 3 Alternate Lab basket.
***************************************************************************************
//personType.h
#include <string>
using namespace std;
class personType
{
public:
void print() const;
//Function to output the first name and last name
//in the form firstName lastName.
void setName(string first, string last);
//Function to set firstName and lastName according
//to the parameters.
//Postcondition: firstName = first; lastName = last
string getFirstName() const;
//Function to return the first name.
//Postcondition: The value of firstName is returned.
string getLastName() const;
//Function to return the last name.
//Postcondition: The value of lastName is returned.
personType(string first = "", string last = "");
//Constructor
//Sets firstName and lastName according to the parameters.
//The default values of the parameters are null strings.
//Postcondition: firstName = first; lastName = last
private:
string firstName; //variable to store the first name
string lastName; //variable to store the last name
};
**************************************************************
//personTypeImp.cpp
#include <iostream>
#include <string>
#include "personType.h"
using namespace std;
void personType::print() const
{
cout << firstName << " " << lastName;
}
void personType::setName(string first, string last)
{
firstName = first;
lastName = last;
}
string personType::getFirstName() const
{
return firstName;
}
string personType::getLastName() const
{
return lastName;
}
//constructor
personType::personType(string first, string last)
{
firstName = first;
lastName = last;
}
Explanation / Answer
class Computer { Computer() { System.out.println("Constructor of Computer class."); } void computer_method() { System.out.println("Power gone! Shut down your PC soon..."); } public static void main(String[] args) { Computer my = new Computer(); Laptop your = new Laptop(); my.computer_method(); your.laptop_method(); } } class Laptop { Laptop() { System.out.println("Constructor of Laptop class."); } void laptop_method() { System.out.println("99% Battery available."); } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.