Write a Program That Read Student Data and Print Report Card Java
Coffee Exercises: Accepts students name, id, and marks and display the highest score and the everyman score
Java Basic: Exercise-245 with Solution
Write a Java program which accepts students name, id, and marks and brandish the highest score and the lowest score.
The pupil name and id are all strings of no more than than x characters. The score is an integer between 0 and 100.
Sample Solution:
Java Code:
import java.util.Scanner; course Pupil { Cord name; String stu_id; int score; public Educatee() { this(" ", " ", 0); } public Pupil(Cord initName, Cord initId, int initScore) { proper noun = initName; stu_id = initId; score = initScore; } } public class Main { public static void primary(String[] args) { Scanner in = new Scanner(Organisation.in); System.out.println("Input number of students:"); int n = Integer.parseInt(in.nextLine().trim()); System.out.println("Input Student Name, ID, Score:"); Student stu = new Educatee(); Student max = new Pupil(); Student min = new Student(" ", " ", 100); for (int i = 0; i < n; i ++) { stu.name = in.next(); stu.stu_id = in.next(); stu.score = in.nextInt(); if (max.score < stu.score) { max.name = stu.name; max.stu_id = stu.stu_id; max.score = stu.score; } if (min.score > stu.score) { min.name = stu.proper name; min.stu_id = stu.stu_id; min.score = stu.score; } } Organisation.out.println("name, ID of the highest score and the lowest score:"); System.out.println(max.name + " " + max.stu_id); Organisation.out.println(min.proper name + " " + min.stu_id); in.close(); } }
Sample Output:
Input number of students: three Input Student Name, ID, Score: Devid v1 72 Peter v2 68 Johnson v3 85 name, ID of the highest score and the lowest score: Johnson v3 Peter v2
Pictorial Presentation:
Flowchart:
Coffee Code Editor:
Contribute your lawmaking and comments through Disqus.
Previous: Write a Java program which reads a list of pairs of a word and a page number, and prints the word and a listing of the corresponding page numbers.
Next: Write a Java program to catechumen three digits positive number in above format. For instance, 234 should be output equally BBSSS1234 because information technology has ii "hundreds", iii "x", and 4 of the ones.
What is the difficulty level of this practise?
Test your Programming skills with w3resource's quiz.
Java: Tips of the Mean solar day
Java: Why don't Java's +=, -=, *=, /= compound assignment operators crave casting?
Equally e'er with these questions, the JLS holds the reply. In this case §15.26.2 Chemical compound Consignment Operators. An extract:
A compound assignment expression of the class E1 op= E2 is equivalent to E1 = (T)((E1) op (E2)), where T is the type of E1, except that E1 is evaluated just in one case.
[...] the following code is correct:
short 10 = 3; ten += four.six;
and results in x having the value 7 because it is equivalent to:
short 10 = 3; x = (brusque)(10 + iv.six);
Ref: https://bit.ly/2YSYBQP
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practise, Solution
- Java Regular Expression: Exercises, Exercise, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Packet exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Packet Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework
Source: https://www.w3resource.com/java-exercises/basic/java-basic-exercise-245.php
Belum ada Komentar untuk "Write a Program That Read Student Data and Print Report Card Java"
Posting Komentar