1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Snezhnost [94]
3 years ago
6

Write a program that does the following: 1. Uses a menu system 2. Creates an array with 25 rows and an unknow number of columns

3. You can assume that the row index represents one individual student 4. Each column represents an exam score for that individual student (the number of exams will vary by student) 5. Enter at least 10 students along with a varying number of exam scores for each different student. 6. Display the Average for all exams by each Student Id 7. Display the Average for each exam by Exam Number 8. Display the class average 9. Everything needs to be a written in Static Method 10. Do not forget your design tool The menu system will have an option to input grades for the next student. Once pressed the user will then enter how many exams that student has taken. The program will then ask the user to enter each of those exam scores. Menu will have an option to display the exam average by student. Menu will have an option to display the exam average by exam. Menu will have an option to display the current class average for all exams.
Computers and Technology
1 answer:
Vilka [71]3 years ago
8 0

Answer:

import java.util.Scanner;

/**

*

* @author pc

*/

public class JaggedARrayAssignment {

private static int students[][] = new int[25][];//create a jagged array having 25 rows and unknown columns

public static void menu()

{

int index=0;//intitalize number of students to zero intially

Scanner sc=new Scanner(System.in);// create scanner for taking input from user

int choice;//choice

int maxExams=0;//maximum number of exams taken by any student

do

{

//print the menu

System.out.println("1-Input grades for next student");

System.out.println("2-Display the exam Average by student");

System.out.println("3-Display the exam Average by exam");

System.out.println("4-Display the current class average for all exams");

System.out.println("5-Exit");

choice=sc.nextInt();

//if choice is 1

if(choice==1)

{//ask how many xams

System.out.println("Please enter how many exams this student has taken?");

int noOfExams=sc.nextInt();//take input

students[index]=new int[noOfExams];//intialize array index by no of exams

System.out.println("Please enter the each of those exam scores one by one");//enter scores

if(maxExams<noOfExams)//if this noofexams is greater then update maxexams

maxExams=noOfExams;

//take scores from user

for(int i=0;i<noOfExams;i++)

{

students[index][i]=sc.nextInt();

}

index++;//increase index

}

else if(choice==2)

{

//calculate avregage by student and print it

System.out.println("*** Average by Student Id ***");

System.out.println("Student Id\tAverage Score");

for(int i=0;i<index;i++)

{

System.out.print((i+1)+"\t");//print student id

int sum=0;

//calculate sum

for(int j=0;j<students[i].length;j++)

{

sum=sum+students[i][j];

}

double avg=sum*1.0/students[i].length;//find average

System.out.printf("%.2f",avg);//print average by precison of two

System.out.println();

}

}

else if(choice==3)

{//caculate averag eby exams and print it

System.out.println("*** Average by Exam Number ***");

System.out.println("Exam Number\tAverage Score");

for(int i=0;i<maxExams;i++)

{

int sum=0,total=0;

for(int j=0;j<index;j++)

{

if(students[j].length>=i+1)

{

total++;

sum=sum+students[j][i];

}

}

double avg=sum*1.0/total;

System.out.print((i+1)+"\t");

System.out.printf("%.2f",avg);

System.out.println();

}

}

else if(choice ==4)

{//find iverall average

int sumtotal=0;

for(int i=0;i<index;i++)

{

int sum=0;

for(int j=0;j<students[i].length;j++)

{

sum=sum+students[i][j];

}

double avg=sum*1.0/students[i].length;

sumtotal+=avg;

}

double avgTotal=sumtotal*1.0/index;

System.out.println("Current class Average for all exams - "+avgTotal);

}

}while(choice!=5);

}

public static void main(String[] args) {

menu();

}

}

You might be interested in
Dione has created a PowerPoint presentation that has several common nouns, names of products, etc. He is
svetlana [45]

Answer:

D. Add

Explanation:

PowerPoint application can be defined as a software application or program designed and developed by Microsoft, to avail users the ability to create various slides containing textual and multimedia informations that can be used during a presentation. Some of the features available on Microsoft PowerPoint are narrations, transition effects, custom slideshows, animation effects, formatting options etc.

In this scenario, Dione has created a PowerPoint presentation that has several common nouns, names of products, etc. He is running Spell Checker and does not want to be notified in regard to these words in this presentation or in any other presentation created on this computer. Hence, the option he should choose is Add. This would be used to automatically add a list of all the common nouns.

3 0
3 years ago
Read 2 more answers
Write 5 chart types​
Lemur [1.5K]

Answer:

pie chart

line chart

area chart

bar charts

histogram

scatter plot

6 0
3 years ago
What keyword is used to declare a method in python?
Harrizon [31]
I think the answer is B
8 0
3 years ago
What data type or you use to represent true or false values?
vfiekz [6]
The Boolean type is used to represent true or false values
3 0
3 years ago
Arnie is planning an action shot and wants the camera to move smoothly alongside his running characters. He is working on a tigh
cricket20 [7]
Camera and wagon are answer
4 0
3 years ago
Other questions:
  • What is client server relationship is the basic form of what
    6·1 answer
  • ____ are systems in which queues of objects are waiting to be served by various servers
    5·1 answer
  • A group of users can perform certain operations on a shared workbook. Which option helps them to update and track changes in the
    14·1 answer
  • If you find yourself boxed in by a vehicle on your left or right _____________
    14·2 answers
  • When talking about changes related to information​ technology, the text identifies three interrelated changes that are responsib
    8·1 answer
  • Does anyone know what anotmy means​
    8·2 answers
  • What are the cues that a website is safe to use for exchanging sensitive information?
    10·1 answer
  • Java-Script Concept quiz:
    6·1 answer
  • 1. Name the first PC virus.<br> 2. In which language are viruses written for Microsoft programs?
    8·2 answers
  • Consider this binary search tree:______.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!