C++ #include #include using namespace std; // Be sure the values of your output are labeled - explai

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

C++ #include #include using namespace std; // Be sure the values of your output are labeled - explai

Post by answerhappygod »

C++
#include <iostream>
#include <vector>
using namespace std;
// Be sure the values of your output are labeled - explain what
the values are for - see sample output
// Be sure to indent properly
// Be sure to include your name, and your sample output
// save your cpp code as extra-credit.txt and upload on
Canvas
//////////////////////////////
// Billing class
//////////////////////////////
/*****************************
private data:
an integer pointer named pAccountNbr
a double pointer named pAmount
public member functions:
a constructor to allocate new memory for the 2
pointers and set their values
the constructor will output the
message: New Billing for account: (account number) // see sample
output
a destructor to free memory for the 2 pointers
the destructor will output the
message: Deleting account: (account number) // see sample
output
a virtual (void) print function to output the
account number and amount // see sample output
getters and setters for the 2 pointers
use "const" for the getters and print function
/****************************/
//////////////////////////////
// Phone class - derived from Billing
//////////////////////////////
/****************************
private data:
an integer named minutes (not a pointer)
public member functions
a constructor with default values of 0 for all
private data
(will call the parent constructor)
as well as set the value of minutes
a print (void) function override that calls the
parent print function
then outputs the minutes // see
sample output
getter and setter for minutes - use const for the
getter and print function
/****************************/
//////////////////////////////
// Rent class - derived from Billing
//////////////////////////////
/****************************
private data:
an string named monthName (not a pointer)
public member functions
a constructor with default values of 0 for all
private data
(will call the parent constructor)
as well as set the value of monthName
a print (void) function override that calls the
parent print function
then outputs the monthName // see
sample output
getter and setter for monthName - use const for
the getter and print function
/****************************/
//////////////////////////////
// main() function
//////////////////////////////
int main() {
vector<Billing*> bills;
int idx = 0, count = 0;
int acctNbr, minutes;
double amt;
string monthName;
// do not declare any other variables!
cout << "How many phones: ";
cin >> count;
// write a loop to prompt the user for phone
billing information
// and add to vector - see sample output
cout << endl << "How many
renters: ";
cin >> count;
// write a loop to prompt the user for rent
billing information
// and add to vector - see sample output
cout << endl;
// write a loop to display all bills
cout << endl;
// write a loop to delete all bills
cout << "Goodbye" <<
endl;
return 0;
}
// sample output - replace with your output
/******************************
How many phones: 2
Enter account number, billing amount, and minutes (separated by
space) for phone 1: 123 45.32 88
New Billing for account: 123
Enter account number, billing amount, and minutes (separated by
space) for phone 2: 234 56.43 99
New Billing for account: 234
How many renters: 2
Enter account number, billing amount, and name of month
(separated by space) for renter 1: 345 67.54 June
New Billing for account: 345
Enter account number, billing amount, and name of month
(separated by space) for renter 2: 456 78.65 July
New Billing for account: 456
Account 123 amount due is 45.32 for 88 phone minutes.
Account 234 amount due is 56.43 for 99 phone minutes.
Account 345 amount due is 67.54 for June rent.
Account 456 amount due is 78.65 for July rent.
Deleting account: 123
Deleting account: 234
Deleting account: 345
Deleting account: 456
Goodbye
/******************************/
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply