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...
5) Create the following in a Java program Create a scanner Prompt the user to enter...
5) Create the following in a Java program Create a scanner Prompt the user to enter the name where the box of mail is shipping from and create the variable and relate to scanner Prompt the user to enter the name of destination where the box of mail will be shipped and create the variable and relate to scanner Prompt the user to enter the weight of the package and create variable to relate to scanner Calculate cost of shipping...
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.
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. Here is the code that I have so far I can't seem to get it...
6) Create the following in a Java Program: Create payroll system Prompt the user to enter...
6) Create the following in a Java Program: Create payroll system Prompt the user to enter payroll information Employee name and create variable for scanner Hours worked Hourly pay rate Federal tax rate State tax rate Declare variable doubles for gross pay, federal, state and total deduction Display payroll statement example: Name of employee Hours worked Hourly pay rate Gross pay which is equal hours worked multiply hourly pay rate Federal withholding which is equal of gross pay multiply federal...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT