Ok, the program allows me to input every value and everything executes, but heres what comes back when the calculations at the bottom are supposed to happen. take a look. Please help?

For your 1st class please select the appropriate number for your grade.
For an A, select 1.
For a B, select 2.
For a C, select 3.
For a D, select 4.
For an F, selcet 5.
Please enter your selection --> 2

Please enter number of credit hours for first class --> 3

For your 2nd class please select the appropriate number for your grade.
For an A, select 1.
For a B, select 2.
For a C, select 3.
For a D, select 4.
For an F, selcet 5.
Please enter your selection --> 3

Please enter number of credit hours for second class --> 4

8
0

Your GPA is --> 1.14286
You are doing poorly.

Press any key to continue . . .

Notice above where the single value 8, well thats Points_1 and it should be 9.

And above the single value 0, well thats Points_2 and it should be 8.

Also above the GPA value should be 2.42875

#include <iostream>
using namespace std;

void main ()
{
	
	int LetterGrade_1 = 0, LetterGrade_2 = 0; 
	double TotalPoints = 0, TotalCreditHours = 0, CreditHours_2 = 0, GPA = 0;
	double CreditHours_1 = 0, Points_1 = 0, Points_2 = 0;

	cout << "For your 1st class please select the appropriate number for your grade.";
	cout << endl;
	cout << "For an A, select 1." << endl;
	cout << "For a B, select 2." << endl;
	cout << "For a C, select 3." << endl;
	cout << "For a D, select 4." << endl;
	cout << "For an F, selcet 5." << endl;
	cout << "Please enter your selection --> ";
	cin >> LetterGrade_1;
	cout << endl;


	
	switch (LetterGrade_1)
	{
	case 1:	
		cout << "Please enter number of credit hours for first class --> ";
		cin >> CreditHours_1;
		cout << endl;
		Points_1 = 4 * CreditHours_1;
		break;

	case 2:
		cout << "Please enter number of credit hours for first class --> ";
		cin >> CreditHours_1;
		cout << endl;
		Points_1 = 3 * CreditHours_1;
		break;

	case 3:
		cout << "Please enter number of credit hours for first class --> ";
		cin >> CreditHours_1;
		cout << endl;
		Points_1 = 2 * CreditHours_1;
		break;

	case 4:
		cout << "Please enter number of credit hours for first class --> ";
		cin >> CreditHours_1;
		cout << endl;
		Points_1 = CreditHours_1;
		break;

	case 5:
		cout << "Please enter number of credit hours for first class --> ";
		cin >> CreditHours_1;
		cout << endl;
		Points_1 = 0;
		break;
	}


	cout << "For your 2nd class please select the appropriate number for your grade.";
	cout << endl;
	cout << "For an A, select 1." << endl;
	cout << "For a B, select 2." << endl;
	cout << "For a C, select 3." << endl;
	cout << "For a D, select 4." << endl;
	cout << "For an F, selcet 5." << endl;
	cout << "Please enter your selection --> ";
	cin >> LetterGrade_2;
	cout << endl;


	
	switch (LetterGrade_2)
	{
	case 1:
		cout << "Please enter number of credit hours for second class --> ";
		cin >> CreditHours_2;
		cout << endl;
		Points_1 = 4 * CreditHours_2;
		break;

	case 2:
		cout << "Please enter number of credit hours for second class --> ";
		cin >> CreditHours_2;
		cout << endl;
		Points_1 = 3 * CreditHours_2;
		break;

	case 3:
		cout << "Please enter number of credit hours for second class --> ";
		cin >> CreditHours_2;
		cout << endl;
		Points_1 = 2 * CreditHours_2;
		break;

	case 4:
		cout << "Please enter number of credit hours for second class --> ";
		cin >> CreditHours_2;
		cout << endl;
		Points_1 = CreditHours_2;
		break;

	case 5:
		cout << "Please enter number of credit hours for second class --> ";
		cin >> CreditHours_2;
		cout << endl;
		Points_1 = 0;
		break;
	}

	cout << Points_1 << endl << Points_2 << endl << endl;
	
	TotalPoints = Points_1 + Points_2;
	TotalCreditHours = CreditHours_1 + CreditHours_2;
	GPA = TotalPoints / TotalCreditHours;

	cout << "Your GPA is --> " << GPA << endl;
                // I only put this here to illustrate what its doing.
	
	if (GPA < 2.0)
	{
		cout << "You are doing poorly." << endl << endl;
	}

	else if (GPA >= 3.5)
	{
		cout << "Congratulations, doing good." << endl << endl;
	}
}

Recommended Answers

All 5 Replies

You're using Points_1 everywhere (even in switch(LetterGrade_2) )
So you might want to assign a value to Points_2 at some point in your program :)
Now you're just overwriting the points value from your first switch in your second switch

I did finally get it figured out, but thanks. and I went a different direction which was easier. check it out. But I am adding a second program if you could look at man it would be awesome because I've litterally tried freaken everything.

#include <iostream>
using namespace std;

void main ()
{
	
	char LetterGrade_1, LetterGrade_2; 
	double TotalPoints = 0, TotalCreditHours = 0, CreditHours_2 = 0, GPA = 0;
	double  CreditHours_1 = 0, Points_1 = 0, Points_2 = 0;
	double TotalPoints_1 = 0, TotalPoints_2 = 0;

	cout << "Please enter letter grade of first class --> ";
	cin >> LetterGrade_1;
	cout << endl;

	if (LetterGrade_1 == 'A')
	
		Points_1 = 4.0;
	
	else if (LetterGrade_1 == 'B')
	
		Points_1 = 3.0;
	
	else if (LetterGrade_1 == 'C')
	
		Points_1 = 2.0;
	
	else if (LetterGrade_1 == 'D')
	
		Points_1 = 1.0;
	
	else if (LetterGrade_1 == 'F')
	
		Points_1 = 0;

		
	
	cout << "Please enter number of credit hours for first class --> ";
	cin >> CreditHours_1;
	cout << endl;

	cout << "Please enter letter grade for second class --> ";
	cin >> LetterGrade_2;
	cout << endl;

	
	if (LetterGrade_2 == 'A')
	
		Points_2 = 4.0;
	
	else if (LetterGrade_2 == 'B')
	
		Points_2 = 3.0;
	
	else if (LetterGrade_2 == 'C')
	
		Points_2 = 2.0;
	
	else if (LetterGrade_2 == 'D')
	
		Points_2 = 1.0;
	
	else if (LetterGrade_2 == 'F')
	
		Points_2 = 0;
	

	cout << "Please enter number of credit hours for second class --> ";
	cin >> CreditHours_2;
	cout << endl << endl;


	TotalPoints_1 = Points_1 * CreditHours_1;
	TotalPoints_2 = Points_2 * CreditHours_2;
	TotalPoints = TotalPoints_1 + TotalPoints_2;
	TotalCreditHours = CreditHours_1 + CreditHours_2;
	GPA = TotalPoints / TotalCreditHours;

	cout << LetterGrade_1 << "     " << CreditHours_1 << endl;
	cout << LetterGrade_2 << "     " << CreditHours_2 << endl;
	cout << "Your GPA is --> " << GPA << endl << endl;
	
	if (GPA < 2.0)
	
		cout << "You are doing poorly." << endl << endl;
	

	else if (GPA >= 3.5)
	
		cout << "Congratulations, doing good." << endl << endl;
	
}

Heres what he wants on the second one and I quote " Your table must display 6 numbers per row and use a spacing of 10 for each number"

Im not sure how to fix this one and its a simple program that got me stumped. If you could help, Thanks

#include <iostream>
#include <iomanip>
using namespace std;

void main ()
{
	int Fib1 = 0;
	int Fib2 = 1;
	int Fib3;
	int counter = 3;
	cout << setw(10) << Fib1 << setw(10) << Fib2;

	do 
	{
		Fib3 = Fib1 + Fib2;
		cout << setw(10) << Fib3;
		Fib1 = Fib2;
		Fib2 = Fib3;
		counter++;
	}
	while (counter <= 40);
		cout << endl << endl;
}

I know I could have used a for loop but this was just as good.

I did finally get it figured out, but thanks. and I went a different direction which was easier.

No it's not. I told you to change six "points_1" to "points_2", but you re-wrote the entire program, that's not 'easier' IMO.
But whatever makes you happy :)

But I am adding a second program if you could look at man it would be awesome because I've litterally tried freaken everything.

Start a new thread if you have a new question.

Hey calm down man, I already had it done before you replied, I had to keep trying things or how else will I learn.

I appretiate the help and advice, but i just kept plugging away.

Thanks ;)

did the other question stump you?

Hey calm down man,

I'm the definition of calm.

did the other question stump you?

Nope. But as I said: If it's a new question, you should start a new thread. If I start answering it here, it will confuse other people that might read this thread, because it covers two very different questions/subjects.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.