Click here to Skip to main content
14,922,560 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
Write a C++ program to calculate the tuition fee for a student at a University. The program should prompt for and accept the idnumber and the total number of credits for which he/she has enrolled. The bill outputted should contain the idnumber and tuition fee.

Calculate the tuition fee as follows:

Total credits of 15 or more indicates that the student is full-time. Full-time students pay a flat rate of $35,000 for tuition.
Total credits of less than 15 indicate that the student is part-time. Part-time students pay $850 per credit for tuition.  
After printing the tuition fee, ask the user if s/he wants to calculate the tuition fee for another student – "Y" for yes and "N" for no. (This question is asked each time the tuition fee is printed). If s/he does, allow him/her to enter another student’s idnumber and total number of credits and find the tuition fee again. If the answer is no, the program must be terminated with an appropriate message. (Please ensure that you include a check to determine if an invalid character is entered).         


What I have tried:

Nothing so far, we have not learnt anything as yet but we’re getting this assignment to do
Posted
Updated 25-Mar-21 0:46am

Quote:
Nothing so far, we have not learnt anything as yet but we’re getting this assignment to do

Then, a fail is the expected answer.
Tell the university you want you money back and look for a tutorial.

There is no way we can teach you programming in the scope of this forum.
   
As a starter, I give you a skeleton:
C++
#include <iostream>
using namespace std;


int compute_tuition_fee(int credits);

int main()
{
  int answer;
  do
  {
    int idnumber, credits;
    cout << "please enter idnumber and total credits\n";
    cin >> idnumber;
    cin >> credits;
    int tuition_fee = compute_tuition_fee(credits);
    cout << "tuition fee is " << tuition_fee << "\n";
    cout << "please enter 1 to continue, any other number to exit\n";
    cin >> answer;
  } while ( answer == 1);
}

int compute_tuition_fee(int credits)
{
  int tuition_fee = 0;
  if ( credits < 15)
  {
    // part-time:
    // assign tuition_fee according to requirements
  }
  else
  {
    // full time
    // assign tuition_fee according to requirements
  }
  return tuition_fee;
}
   
No, we're not here to do your work for you. Assignments are a test of YOUR knowledge, not ours.

I agree you haven't learned anything, but that doesn't mean you weren't taught anything.

You've been taught how to get input from the user.

You've been taught how to do calculations on numeric data.

You've been taught how if statements work.

You've been taught how to output stuff to the console.

There really isn't anything more to this app than that.
   
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
   
Spend some time to visit some Learn C++ tutorila and use the great sceleton from our "free lunch coder" CPallini. ;-)
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900