Question

In: Computer Science

Previously, you wrote a program named Admission for a college admissions office in which the user...

Previously, you wrote a program named Admission for a college admissions office in which the user enters a numeric high school grade point average and an admission test score. The program displays Accept or Reject based on those values. Now, create a modified program named AdmissionModularized in which the grade point average and test score are passed to a method that returns a string containing Accept or Reject.

CODE:

using System;

using static System.Console;

class Admission

{

   static void Main()

   {

      double gpa;

      int testScore;

      const double MINGPA = 3.0;

      const int ADMIN1 = 60, ADMIN2 = 80;

      string inputString;

      WriteLine("Enter grade point average ");

      inputString = ReadLine();

      gpa = Convert.ToDouble(inputString);

      WriteLine("Enter test score ");

      inputString = ReadLine();

      testScore = Convert.ToInt32(inputString);

      if(gpa >= MINGPA)

         if(testScore >= ADMIN1)

            WriteLine("Accept");

         else

            WriteLine("Reject");

      else

         if(testScore >= ADMIN2)

            WriteLine("Accept");

         else

            WriteLine("Reject");

   }

    public static string AcceptOrReject(double gpa, int testScore)

   {

    // Write your AcceptOrReject method here.

   }

}

Solutions

Expert Solution

Below is modified program for AdmissionModularized in which the grade point average and test score are passed to a method that returns a string containing Accept or Reject.

using System;

using static System.Console;

class AdmissionModularized

{
    const double MINGPA = 3.0;

    const int ADMIN1 = 60, ADMIN2 = 80;

   static void Main()

   {

      double gpa;

      int testScore;

      string inputString;

      WriteLine("Enter grade point average ");

      inputString = ReadLine();

      gpa = Convert.ToDouble(inputString);

      WriteLine("Enter test score ");

      inputString = ReadLine();

      testScore = Convert.ToInt32(inputString);

      string result = AcceptOrReject(gpa,testScore);
      WriteLine(result);
   }


    // AcceptOrReject method here.
    public static string AcceptOrReject(double gpa, int testScore)
   {
       if(gpa >= MINGPA)

         if(testScore >= ADMIN1)

            return "Accept";

         else

            return "Reject";

      else

         if(testScore >= ADMIN2)

            return "Accept";

         else

            return "Reject";

   }
}

Output:



Related Solutions

The admissions office of a small college is asked to accept deposits from a number of...
The admissions office of a small college is asked to accept deposits from a number of qualified prospective freshmen so that, with probability about 0.95, the size of the freshman class will be less than or equal to 1,100. Suppose the applicants constitute a random sample from a population of applicants, 80% of whom would actually enter the freshman class if accepted. (Use the normal approximation.) (a) How many deposits should the admissions counselor accept? (Round your answer up to...
A college admissions office takes a simple random sample of 120 entering freshmen and computes their...
A college admissions office takes a simple random sample of 120 entering freshmen and computes their mean SAT score to be 448. The population standard deviation is 116. Bsed on a 98%confidence interval mean, is it likely that the mean SAT score for entering freshmen is greater than 464? (first construct the 98% confidence interval)
3. [1 pts] Part A. Write a program for the GW Admissions Office. a) Request the...
3. [1 pts] Part A. Write a program for the GW Admissions Office. a) Request the staff to enter a string, to indicate someone’s NetID. b) Generates an email address, by appending “@gwmail.gwu.edu” to the user input c) Print the generated email account [2 pts] Part B. Write a program to meet additional requirements. In addition to requirements in Part A, your function should perform the following check: a) If the user input is longer than 10 characters (11 or...
c# In Chapter 2, you created an interactive application named MarshallsRevenue. The program prompts a user...
c# In Chapter 2, you created an interactive application named MarshallsRevenue. The program prompts a user for the number of interior and exterior murals scheduled to be painted during the next month by Marshall’s Murals. Next, the programs compute the expected revenue for each type of mural when interior murals cost $500 each and exterior murals cost $750 each. The application also displays the total expected revenue and a statement that indicates whether more interior murals are scheduled than exterior...
A college admissions officer for the school’s online undergraduate program wants to estimate the mean age...
A college admissions officer for the school’s online undergraduate program wants to estimate the mean age of its graduating students. The administrator took a random sample of 40 from which the mean was 24 years and the standard deviation was 1.7 years. If the mean age of online undergraduate students was 23 years of age, what is the probability that the sample of 40 would have produced a mean age of 24 or higher? Be sure to set up the...
Using Java, write a program named MyAngles that will prompt the user for the measure of...
Using Java, write a program named MyAngles that will prompt the user for the measure of the three sides of a triangle and then reports the measurement of each interior angle of the triangle and the area of the triangle.
Use Excel to answer. A college admission officer for an MBA program determines that historically candidates...
Use Excel to answer. A college admission officer for an MBA program determines that historically candidates have undergraduate grade averages that are normally distributed with standard deviation of .45. A random sample of 25 applications from the current year yields a sample mean grade point average of 2.90. Find a 95% confidence interval for the population mean, μ. (Round the boundaries to 2 decimal places.) Based on the same sample results, a statistician computes a confidence interval for the population...
Compute in excel A college admission officer for an MBA program determines that historically candidates have...
Compute in excel A college admission officer for an MBA program determines that historically candidates have undergraduate grade averages that are normally distributed with standard deviation of .45. A random sample of 25 applications from the current year yields a sample mean grade point average of 2.90. (i) Find a 95% confidence interval for the population mean, μ. (Round the boundaries to 2 decimal places.) (ii) Based on the same sample results, a statistician computes a confidence interval for the...
So previously in my class I had to write a python program where the user would...
So previously in my class I had to write a python program where the user would enter the price for 5 different items, and it would calculate the subtotal, total tax owed and the total amount owed. Now I need to write a program that would do the same but would be done using modules in the code, I am having a hard time figuring modules out. Below is the code from the original program not using modules: # Enter...
personal statement: state your reason for seeking admission to the nursing program at Regis College. include...
personal statement: state your reason for seeking admission to the nursing program at Regis College. include your professional goals, why you want to pursue a career as a nurse practitioner and how admission to the nursing program will assist you in accomplishing those goals
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT