Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Pls help on this read Input

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi everybody,
I need ur assistance, as this program have errors, which i unable to correct it.
Appreciate your assistance on this matter.
Create a record contains 15 students and read the input from user.
1) We are free invited to enter the details of a Student with the name,and enter the 3 Marks obtained in each 3 subjects. (like..Integer.parseInt(input);read their input)
2) Compute the average score for each student, then display the highest average score and lowest average score.
Develop in Application and print out the input from what user entered.
Below is the source code
==================================================

//run this program as GoodLuck.java
import java.io.*;
import java.lang.*;
class GoodLuck
{
public static void main(String args[]) throws IOException
{
String[] name = new String[15];
int[] students = new int[15];
String Studname;
int mark1, mark2, mark3;

BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter your Name:");
System.out.println("Enter your mark1");
System.out.println("Enter your mark2");
System.out.println("Enter your mark3");

for(int i =0; i <=14; i++)
{
Studname = input.readLine();
mark1= Integer.parseInt(input.readLine());
mark2= Integer.parseInt(input.readLine());
mark3= Integer.parseInt(input.readLine());
name[i] =Studname;
students[i] = mark1;
students[i] = mark2;
students[i] = mark3;

};
double highestAvg = -1.0;
double lowestAvg = 101.0;


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

for (int i = 0; i < students.length; i++)
{
double avg = (students[i].mark1 + students[i].mark2 +
students[i].mark3) / 3.0;
if (avg > highestAvg)
highestAvg = avg;
if (avg < lowestAvg)
lowestAvg = avg;
System.out.print (students[i].name + " " +
students[i]+ " " +
students[i]+ " " +
students[i]+ " " + avg + " ");
if (avg < 40)
System.out.println ("FAIL");
else
if (avg < 60)
System.out.println ("PASS");
else
if (avg < 70)
System.out.println ("CREDIT");
else
System.out.println ("DISTINCTION");
}
System.out.println ();

System.out.println ("Highest Average = " + highestAvg);
System.out.println ("Lowest Average = " + lowestAvg);
}
}
 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
respond in this thread. We are still waiting for your response there to tell us the problem you are having.
Jamie
 
And will you succeed? Yes you will indeed! (98 and 3/4 % guaranteed) - Seuss. tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
    Bookmark Topic Watch Topic
  • New Topic