Page 310 - IT-802_class_12
P. 310
Report Card Generation
2. Write a project in Java to display the report card of the student as per following format:
-------------------------------------------------------------------------------
First_Name Last_Name Total_Marks Average
……………… ……………… …………….. ……………
-------------------------------------------------------------------------------
a. Take the following input from the user using Scanner class:
u Student First name
u Student Last name
u Three Subject marks of the student (Hindi, English, Math)
b. Calculate the total marks and average of the student.
import java.util.*;
public class Report_Card
{
public static void main()
{
Scanner sc = new Scanner(System.in);
int choice = 1;
while(true)
{
switch(choice)
{
case 1:
System.out.print(“Enter First name of the student :”);
String f_name = sc.next();
System.out.print(“Enter Last name of the “+f_name+” :”);
String l_name = sc.next();
System.out.print(“Enter marks in Hindi of “+f_name+” :”);
int Hindi = sc.nextint();
System.out.print(“Enter marks in English of “+f_name+” :”);
int English = sc.nextint();
System.out.print(“Enter marks in math “+f_name+” :”);
int math = sc.nextint();
int total_marks = Hindi + English + math;
double average = total_marks/3.0;
System.out.println(“---------------------------------------------”);
System.out.println(“First_Name\tLast_Name\tTotal_marks\
tAverage”);
System.out.println(f_name+”\t\t”+l_name+”\t\t”+total_
marks+”\t\
t”+average);
308 Touchpad Information Technology-XII

