MIS 260 Practice - week 4

 

I am not going to provide initial values for variables. Thus, use your own initial values from now on.

 

1.      Write a grading program using Java. If the grade is greater than or equal to 60, the program prints “Passed”. Otherwise, the program prints “Failed”.  Then, test the program using an appropriate variable (one integer). Save the program as Grade.java

               

                                Output:      Passed (or Failed)         

 

2.      Write a program that compares your checking account balance with your savings account balance (integer or double?, number of variable(s)?). Assign values to both variables, compare them, and then display either “Checking is higher” or “Checking is not higher”. Save the program as Balance.java

 

                                 Output:      Checking is higher (or Checking is not higher)                                                                 

 

3.      Write a program for a college’s admissions office. Create variables to store a student’s numeric high school grade point average (GPA) and an admission test score. Print the message “Accept” if the student has any of the following:        

-  A GPA of 3.0 or above and an admission test score of at least 60

-  A GPA below 3.0 and an admission test score at least 80     

Save the program as Admission.java. Test the program using (an) appropriate variable(s).

 

                                Output:       The Grade Point Average is 3.5
                                                    The Score is 59
                                                    Reject

 

4.      Write a program that stroers IQ score. If the score is a number less than 0 or greater than 200, issue an error message; otherwise, issue an “above average”, “average”, or “below average” message for scores over, at, or under 100, respectively. Save the program as IQ.java. Test the program using (an) appropriate variable(s).

                                Output:         285 is an invalid IQ score
                                                100 is average
                                                91 is below average
                                                105 is above average

Java Assignment 3: (Turn in by email – attach the program)

Due: will be announced by instructor

Score: 10 points

 

1.      Write a program that declares two integers named myNumberOfSiblings and yourNumberOfSiblings. DFisplay an appropriate message to indicate whether your friend has more, fewer, or the same number of siblings as you. Display the number of siblings whether the if statement is true or not. Save the program as Siblings.java. Test the program using (an) appropriate variable(s).

                               

                                Output:         I have 5 siblings and you have 3 I have more siblings
                                                I have 3 siblings and you have 5 You have more siblings
                                                We have the same number of siblings: 3