Question

Write a program that determines how many terms 10 students need to graduate.

Step 1. Create an algorithm (either flowchart or pseudocode) that you will use to write the program. Place the algorithm in a Word document.

Step 2. Code the program in Eclipse and ensure the following steps are accomplished.

1.  Define a two-dimension array with 10 rows and 2 columns.

2.  Prompt the user to enter the number of courses they have left to graduate (value must be between 1 and 20) and how many courses they plan to take each term (value must be between 1 and 5). If the user enters either value out of range then the user must be prompted to reenter.

3. The program must store the number of courses a student has left and how many courses they plan to take each term in a different row of the array, i.e. the first student’s number of courses and how many they plan to take each term will be stored in first row of array. The second student’s info will be in second row, and so on.

4. The program must compute the number of terms a student has remaining, and this should be an integer.   For example, if a student has 15 courses remaining and plans to take 2 a term then they need 8 terms to complete the courses. In other words, you can have 7.5 terms because the student must attend an entire term.

Your output should look like the sample below. Use the Snipit tool in Windows or a similar tool on the Mac to cut and paste t

0 0
Add a comment Improve this question Transcribed image text
Answer #1
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        int arr[][] = new int[10][2];
        Scanner in = new Scanner(System.in);
        for (int i = 0; i < 10; i++) {
            do {
                System.out.print("Enter classes remaining and taking each term for student " + (i + 1) + ": ");
                arr[i][0] = in.nextInt();
                arr[i][1] = in.nextInt();
                if(arr[i][0] < 1 || arr[i][0] > 20) {
                    System.out.println("The number of remaining classes for student " + (i + 1) + " is not valid");
                    i--;
                }
                if(arr[i][1] < 1 || arr[i][1] > 5) {
                    System.out.println("The number of classes per term for student " + (i + 1) + " is not valid");
                    i--;
                }
            } while (arr[i][0] < 1 || arr[i][0] > 20 || arr[i][1] < 1 || arr[i][1] > 5);
        }

        for (int i = 0; i < 10; i++) {
            int terms = (int)Math.ceil(Double.valueOf(arr[i][0]) / arr[i][1]);
            System.out.println("Student " + (i + 1) + " needs " + terms + " terms to graduate");
        }
    }
}
Add a comment
Know the answer?
Add Answer to:
Write a program that determines how many terms 10 students need to graduate. Step 1. Create...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that determines how many terms 10 students need to graduate. Step 1. Create...

    Write a program that determines how many terms 10 students need to graduate. Step 1. Create an algorithm (either flowchart or pseudocode) that you will use to write the program. Place the algorithm in a Word document. Step 2. Code the program in Eclipse and ensure the following steps are accomplished. 1.  Define a two-dimension array with 10 rows and 2 columns. 2.  Prompt the user to enter the number of courses they have left to graduate (value must be between 1...

  • Write C++ program (studentsGpa.cpp) uses dynamic allocation to create an array of strings. It asks the...

    Write C++ program (studentsGpa.cpp) uses dynamic allocation to create an array of strings. It asks the user to enter a number and based on the entered number it allocates the array size. Then based on that number it asks the user that many times to enter student’s names. What you need to do:  Add another array of doubles to store the gpa of each student as you enter them  You need to display both the student’s name and...

  • Create a C# program that will first prompt the instructors to enter the number of students...

    Create a C# program that will first prompt the instructors to enter the number of students they currently have in their classes. Use this value for the size of the row dimension of your multidimensional array. Next, prompt the instructors to type in the number of scores they would like to enter. This variable will be used to designate the column size dimension of your multidimensional array. Then, use a loop to prompt the user to enter the number of...

  • Problem Specification: Write a C++ program to calculate student’s GPA for the semester in your class. For each student, the program should accept a student’s name, ID number and the number of courses...

    Problem Specification:Write a C++ program to calculate student’s GPA for the semester in your class. For each student,the program should accept a student’s name, ID number and the number of courses he/she istaking, then for each course the following data is needed the course number a string e.g. BU 101 course credits “an integer” grade received for the course “a character”.The program should display each student’s information and their courses information. It shouldalso display the GPA for the semester. The...

  • c++ Instructions Overview In this programming challenge you will create a program to handle student test...

    c++ Instructions Overview In this programming challenge you will create a program to handle student test scores.  You will have three tasks to complete in this challenge. Instructions Task 1 Write a program that allocates an array large enough to hold 5 student test scores. Once all the scores are entered, the array should be passed to a function that sorts them in ascending order. Another function should be called that calculates the average score. The program should display the...

  • Problem Statement: Registrar’s Office. This registrar keeps a record of undergraduate students and graduate students. They...

    Problem Statement: Registrar’s Office. This registrar keeps a record of undergraduate students and graduate students. They want us to write an app that stores their students and displays them to the user. For each undergrad student, the app will show the name of the student, the student’s id, whether (true/false) the student is going to graduate school and the student’s high school. For each grad student, the app will show the name of the student, the student’s id, the class...

  • Program in C++! Thank you in advance! Write a menu based program implementing the following functions: (1) Write a funct...

    Program in C++! Thank you in advance! Write a menu based program implementing the following functions: (1) Write a function that prompts the user for the name of a file to output as a text file that will hold a two dimensional array of the long double data type. Have the user specify the number of rows and the number of columns for the two dimensional array. Have the user enter the values for each row and column element in...

  • [JAVA/chapter 7] Assignment: Write a program to process scores for a set of students. Arrays and...

    [JAVA/chapter 7] Assignment: Write a program to process scores for a set of students. Arrays and methods must be used for this program. Process: •Read the number of students in a class. Make sure that the user enters 1 or more students. •Create an array with the number of students entered by the user. •Then, read the name and the test score for each student. •Calculate the best or highest score. •Then, Calculate letter grades based on the following criteria:...

  • C# Write a program that takes a list of information and grades of the students of...

    C# Write a program that takes a list of information and grades of the students of a class and perform some processing. Take the following steps to write the program. The program must give the user two options such as a menu. At the beginning of the program must ask the following from the user: Which task you want to do (choose an option between 1-2), 1- Entering new information 2- Searching a student If the user types something rather...

  • Create a new NetBeans project called PS1Gradebook. Your program will simulate the design of a student...

    Create a new NetBeans project called PS1Gradebook. Your program will simulate the design of a student gradebook using a two-dimensional array. It should allow the user to enter the number of students and the number of assignments they wish to enter grades for. This input should be used in defining the two-dimensional array for your program. For example, if I say I want to enter grades for 4 students and 5 assignments, your program should define a 4 X 5...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT