Question

In: Computer Science

Create a java program that will do the following: Create a method called getInt.Allow the user...

Create a java program that will do the following:

Create a method called getInt.Allow the user to enter up to 20 student names,and for each student 3 quiz scores (in the range 0-100). Once input is done, display each student’s name, their three quiz scores, and their quiz score average, one student per line. The output table does not need to line up perfectly in columns.Use dialog boxes for all input and output.Use the method to input the three scores.Parameter 1 is a String, used for the input prompt (example:“Enter the number of objects ordered"). Use 5 arrays, one for the names, 3 for the scores, and one for the average.Write a method that takes three values and returns their average, and use this to calculate each student’s average.

Solutions

Expert Solution

package as1;

import java.util.Scanner;

public class Application2 {
   public static void main(String[] args) {
       int i=0;
       Scanner sc=new Scanner(System.in);
       System.out.println("enter number of students ");
       int number=sc.nextInt();
String[]   student_name=new String[number];
       int [] quiz1=new int[number];
       int[] quiz2=new int[number];
int[]       quiz3=new int[number];
       float avg[]=new float[20];


       while(i<number){
          
  
           System.out.println("enter student name");
           String name=sc.next();
           student_name[i]=name;
           ///System.out.println(student_name[i]);
           System.out.println("enter first quiz score");
           int quiz_score1=sc.nextInt();
           quiz1[i]=quiz_score1;
           System.out.println("enter second quiz score");
           int quiz_score2=sc.nextInt();
           quiz2[i]=quiz_score2;
           System.out.println("enter third quiz score");
           int quiz_score3=sc.nextInt();
           quiz3[i]=quiz_score3;
           // for average
           avg[i]=((quiz1[i]+quiz2[i]+quiz3[i])/3);
          
           i++;
          
          
          
       }
       System.out.println("name quiz 1 quiz 2 quiz 3 average ");
       for(int j=0;j<=number-1;j++){
          
           System.out.println(student_name[j]+" "+quiz1[j]+" "+quiz2[j]+" "+quiz3[j]+" "+avg[j] );
       }
      
      
   }
  

}


Related Solutions

Create a Netbeans project called LineNumbers The program should do the following: –Ask the user for...
Create a Netbeans project called LineNumbers The program should do the following: –Ask the user for how many lines of text they wish to enter –Declare and initialize an array of Strings to hold the user’s input –Use a while loop to prompt for and read the Strings (lines of text) from the user at the command line. Typically, this would be a 'for' loop since we know the number of times to execute the loop based upon the number...
Create a Java method that does the following: 1) Ask the user for a dividend and...
Create a Java method that does the following: 1) Ask the user for a dividend and a divisor both of "int" type. 2) Computes the remainder of the division. The quotient (answer) must be of the "int" type. Do NOT use the method " % " provided in Java in your code. Remember that it gives wrong answers when some of the inputs are negative. Please see the videos for the explanation.
IN JAVA PROGRAMMING Write a complete Java program to do the following: a) Prompt the user...
IN JAVA PROGRAMMING Write a complete Java program to do the following: a) Prompt the user to enter the name of the month he/she was born in (example: September). b) Prompt the user to enter his/her weight in pounds (example: 145.75). c) Prompt the user to enter his/her height in feet (example: 6.5). d) Display (print) a line of message on the screen that reads as follows: You were born in the month of September and weigh 145.75 lbs. and...
Create in Java a program that will prompt the user to enter aweight for a...
Create in Java a program that will prompt the user to enter a weight for a patient in kilograms and that calculates both bolus and infusion rates based on weight of patient in an interactive GUI application, label it AMI Calculator. The patients weight will be the only entry from the user. Use 3999 as a standard for calculating BOLUS: To calculate the BOLUS you will multiply 60 times the weight of the patient for a total number. IF the...
Create in java a program that will prompt the user to enter a weight for a...
Create in java a program that will prompt the user to enter a weight for a patient in kilograms and that calculates infusion rates based on weight of patient in an interactive GUI application, label it HEPCALC. The patients’ weight will be the only entry from the user. To calculate the infusion rate you will multiply 12 times the weight divided by 50 for a total number. The end result will need to round up or down the whole number....
(JAVA) Create a program that prompts the user for an age input. The program defines the...
(JAVA) Create a program that prompts the user for an age input. The program defines the age group of the user. Follow the table below to construct the output for your program. Age Age Group 0 Baby 1-3 Toddler 4-11 Child 12-17 Teenager 18-21 Young Adult 22-64 Adult 65+ Senior Negative Number Invalid Input Sample Input Enter an age: 18 Sample Output: You are a young adult. Sample Input Enter an age: 29 Sample Output: You are an adult. Sample...
Write a method in JAVA to do the following: As the user to select from 2...
Write a method in JAVA to do the following: As the user to select from 2 different (default) pokemon or load their pokemon by giving you the name of their pokemon. Based on their selection (default or supplied name), read the move list and damage range from the input file(you do not need to create this) for the selected pokemon. Randomly select one of the default pokemon - Bulbasaur, Charmander, Squirtle (or you can add additional computer only options if...
Create a Java program that asks a user to enter two file names. The program will...
Create a Java program that asks a user to enter two file names. The program will read in two files and do a matrix multiplication. Check to make sure the files exist. first input is the name of the first file and it has 2 (length) 4 5 6 7 Second input is the name of the second file and it has 2 (length) 6 7 8 9 try catch method
The following program will be written in JAVA. Create a class called complex performing arithmetic with...
The following program will be written in JAVA. Create a class called complex performing arithmetic with complex numbers. Write a program to test your class.                         Complex numbers have the form:                         realPart + imaginaryPart * i                                               ___                         Where i is sqrt(-1)                                                 Use double variables to represent data of the class. Provide a constructor that enables an object of this class to be initialized when it is declared. The constructor should contain default values in...
Java Programming Create a program that prompts the user for an integer number and searches for...
Java Programming Create a program that prompts the user for an integer number and searches for it within an array of 10 elements. What is the average number of comparisons required to find an element in the array? Your program should print the number of comparisons required to find the number or determine that the number does not exist. Try finding the first and last numbers stored in the array. Run your program several times before computing the average.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT