-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstudentinfo.java
29 lines (28 loc) · 1.01 KB
/
studentinfo.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Design an application in java that contains a class Student having properties
// name and percentage. Create a class Test that declares three instances of Student class.
// The values are passed through constructor at the time of its object creation.
// The output should be the name and percentage of the topper.
package com.company;
import java.util.Scanner;
class test{
private String Name;
private double percentage;
test(String name, double Percentage){
Name=name;
percentage=Percentage;
}
public void print(){
System.out.println("Name of student is "+Name+" and the percentage is "+percentage);
}
}
public class application {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("Enter the name of the student ");
String nam=sc.nextLine();
System.out.println("Enter the percentage of student ");
double per=sc.nextDouble();
test ts=new test(nam, per);
ts.print();
}
}