9
Reply

Admission

Prime b

Prime b

Dec 30 2011 1:43 PM
3k
Hey guys, this is my problem

Write a console-based program for a college's admissions
offi ce. Th e user enters a numeric high school grade point
average (for example, 3.2) and an admission test score.
Display the message "Accept" if the student meets either
of the following requirements:
• A grade point average of 3.0 or higher and an admission
test score of at least 60
• A grade point average of less than 3.0 and an admission
test score of at least 80
If the student does not meet either of the qualifi cation criteria,
display "Reject"


This is what I have done. All I am curious about is if there an alternative way to do this problem if there is, could you tell me please?
Also, first time I wrote the code every time I would plug the numbers in it would show me two messages at the same time "Accepted" and "Rejected" , so I was like what is the problem, then I looked at the problems you helped solve before, and I realized I didn't put 'return'. I put return statement and now it all works! So glad I am learning something =).



            double pointAverage = 3.0;
            double testScore = 60;
            double testScore1 = 80;
            double userInPut1, userInPut2;
            string stringUserInPut1, stringUserInPut2;



            Console.WriteLine("Please enter your point grade average");
            stringUserInPut1 = Console.ReadLine();
            userInPut1 = Convert.ToDouble(stringUserInPut1);

            Console.WriteLine("Please enter your admission test score");
            stringUserInPut2 = Console.ReadLine();
            userInPut2 = Convert.ToDouble(stringUserInPut2);

            if (userInPut1 >= pointAverage && userInPut2 >= testScore)
            {
                Console.WriteLine("You are accepted, congratulations!");
                return;
            }
            if ( userInPut1 < pointAverage && userInPut2 >= testScore1)
            {
                Console.WriteLine("You are accepted , conratulations!");
                return;
            }
                else
                {
                    Console.WriteLine(" Sorry, but you do not meet requirements ");
                }

Answers (9)