Question

C++ i have started the program i just need help finishing it. This chapter is on...

C++ i have started the program i just need help finishing it.

This chapter is on functions. If you write this assignment without creating functions (main itself does not count) then the maximum score you can receive is 10% of the grade even if the output is perfectly correct.

Write a modular program with the following Functions: Main, PrintHeading, PrintTuitionTable

The Main Function should ask the user for a Tuition like assignment 6.

  • Then it should call the PrintHeading function,
  • and then call the PrintTuitionTable and pass it the Tuition, .03, and 4 as parameters.
  • Then it should print a message “But, if you took more classes and graduate in three it is”.
  • Then it should call the PrintHeading function again
  • and then call the PrintTuitionTable function again and pass it the Tuition, .03, and 3 as parameters.

The PrintHeading function should print a message with the school’s name and that this is a tuition expenses table.

The PrintTuitionTable function should catch the Tuition, .03, and 4 as parameters (or arguments if you prefer how the author calls them that here) and use these three values to print a Tuition table and total just like you did in assignment 6.

(The end result is that it should print a message, the table, a message, and the table with different values.)

Below is what i have but i am having syntax errors

#include <iostream>
#include <string>

using namespace std;

//prototypes
void printHeading();
void printTuitionTable(int fee, int incr, int years);


int main()
{
   double fee, incr, total = 0;
   int years;

  
   cout << "How much is tuition now? ";
   cin >> fee;
   cout << "How much is it increasing each year? ";
   cin >> incr;
   cout << "How many years left? ";
   cin >> years;
   incr = incr + 1;

   cout << "Here are your expected remaining payments: \n";
   for (int i = 0;i < years;i++)
   {

       total = total + fee;
       fee = fee * incr;
       cout << fee << endl;
   }
   total += fee;
   cout << "Total : " << total;

   printHeading();
   printTuitionTable(int fee, int incr, int years);
   return 0;
}

void printHeading()
{
   cout << "This is what tuition will cost you if you do it in less years!\n";
}

void printTuitionTable(int fee, int incr, int years)
{
   double fee, incr, total = 0;
   int years;

   cout << "But if you took more classes and graduated in 1 less year it would be.\n";
   incr = incr - 1;
   for (int i = 0;i < years;i++)
   {

       total = total + fee;
       fee = fee * incr;
       cout << fee << endl;
   }
   total += fee;
   cout << "Total : " << total;
}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

//this program can be accessed at cpp.sh/45ost

#include <iostream>
#include <string>

using namespace std;

//prototypes
void printHeading();
void printTuitionTable(double fee, double incr, double years);


int main()
{
double fee, incr, total = 0;
int years;
  
  
cout << "How much is tuition now? ";
cin >> fee;
double initial_fee = fee;
cout << "How much is it increasing each year? ";
cin >> incr;
cout << "How many years left? ";
cin >> years;
incr = incr + 1;
cout << "Here are your expected remaining payments: \n";
for (int i = 0;i < years;i++)
{

fee = fee * incr;
total = total + fee;
cout << fee << endl;
}
total += fee;
cout << "Total : " << total<<endl;

printHeading();
printTuitionTable(initial_fee, incr, years);
return 0;
}

void printHeading()
{
cout << "This is what tuition will cost you if you do it in less years!\n";
}

void printTuitionTable(double fee, double incr, double years)
{
double total = 0;
cout << "But if you took more classes and graduated in 1 less year it would be.\n";

years--;
for (int i = 0;i < years;i++)
{
fee = fee * incr;
total = total + fee;
cout << fee << endl;
}

cout << "Total : " << total;
}

Add a comment
Know the answer?
Add Answer to:
C++ i have started the program i just need help finishing it. This chapter is on...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is for a C++ program: I'm almost done with this program, I just need to...

    This is for a C++ program: I'm almost done with this program, I just need to implement a bool function that will ask the user if they want to repeat the read_course function. I can't seem to get it right, the instructions suggest a do.. while loop in the main function. here is my code #include <iostream> #include <cstring> #include <cctype> using namespace std; const int SIZE = 100; void read_name(char first[], char last[]); void read_course(int & crn, char des[],...

  • I need help finishing my C++ coding assignment! My teacher has provided a template but I...

    I need help finishing my C++ coding assignment! My teacher has provided a template but I need help finishing it! Details are provided below and instructions are provided in the //YOU: comments of the template... My teacher has assigned a game that is similar to battleship but it is single player with an optional multiplayer AI... In the single player game you place down a destroyer, sub, battleship, and aircraft carrier onto the grid.... Then you attack the ships you...

  • -can you change the program that I attached to make 3 file songmain.cpp , song.cpp ,...

    -can you change the program that I attached to make 3 file songmain.cpp , song.cpp , and song.h -I attached my program and the example out put. -Must use Cstring not string -Use strcpy - use strcpy when you use Cstring: instead of this->name=name .... use strcpy ( this->name, name) - the readdata, printalltasks, printtasksindaterange, complitetasks, addtasks must be in the Taskmain.cpp - I also attached some requirements below as a picture #include <iostream> #include <iomanip> #include <cstring> #include <fstream>...

  • THIS IS FOR C++ PROGRAMMING USING VISUAL STUDIO THE PROGRAM NEEDS TO BE IN C++ PROGRAMMING #inclu...

    THIS IS FOR C++ PROGRAMMING USING VISUAL STUDIO THE PROGRAM NEEDS TO BE IN C++ PROGRAMMING #include "pch.h" #include #include using namespace std; // Function prototype void displayMessage(void); void totalFees(void); double calculateFees(int); double calculateFees(int bags) {    return bags * 30.0; } void displayMessage(void) {    cout << "This program calculates the total amount of checked bag fees." << endl; } void totalFees() {    double bags = 0;    cout << "Enter the amount of checked bags you have." << endl;    cout <<...

  • I need help with this C++ problem so far my algorithm is looking like this. #include...

    I need help with this C++ problem so far my algorithm is looking like this. #include using namespace std; void input(char fullname[35], int weight, int distance); double totalcharges(); main() { char fullname[35]; int weight; int distance; for(int i = 1; i <= 3; i++) {   input(fullname, weight, distance); } } void input(char fullname[35], int weight, int distance) { char f[35]; //full name int w; // weight int d; // distance cout << "What is your full name? Please enter `...

  • C++ Object Oriented assignment Can you please check the program written below if it has appropriately...

    C++ Object Oriented assignment Can you please check the program written below if it has appropriately fulfilled the instructions provided below. Please do the necessary change that this program may need. I am expecting to get a full credit for this assignment so put your effort to correct and help the program have the most efficient algorithm within the scope of the instruction given. INSTRUCTIONS Create a fraction class and add your Name to the name fraction and use this...

  • Using C++ Write two `void` functions.  These functions each take two  integer parameters.  The functions accomplish the following tasks....

    Using C++ Write two `void` functions.  These functions each take two  integer parameters.  The functions accomplish the following tasks. The first function prints out the numbers from the first argument up to and including the number passed as the second argument counting by the first argument (i.e. if the arguments are 2 and 10, the information below was given: #include <iostream> using namespace std; // function definitions// // main program int main() {   int firstNumber,secondNumber;   char countType, doAgain;   // we will do this...

  • c++, I am having trouble getting my program to compile, any help would be appreciated. #include...

    c++, I am having trouble getting my program to compile, any help would be appreciated. #include <iostream> #include <string> #include <string.h> #include <fstream> #include <stdlib.h> using namespace std; struct record { char artist[50]; char title[50]; char year[50]; }; class CD { //private members declared private: string artist; //asks for string string title; // asks for string int yearReleased; //asks for integer //public members declared public: CD(); CD(string,string,int); void setArtist(string); void setTitle(string); void setYearReleased(int); string getArtist() const; string getTitle() const; int...

  • C++ Programming - Design Process I need to create a flow chart based on the program...

    C++ Programming - Design Process I need to create a flow chart based on the program I have created. I am very inexperienced with creating this design and your help will be much appreciated. My program takes a string of random letters and puts them them order. Our teacher gave us specific functions to use. Here is the code: //list of all the header files #include <iomanip> #include <iostream> #include <algorithm> #include <string> using namespace std; //Here are the Function...

  • Need help with a C++ program. I have been getting the error "this function or variable...

    Need help with a C++ program. I have been getting the error "this function or variable may be unsafe" as well as one that says I must "return a value" any help we be greatly appreciated. I have been working on this project for about 2 hours. #include <iostream> #include <string> using namespace std; int average(int a[]) {    // average function , declaring variable    int i;    char str[40];    float avg = 0;    // iterating in...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT