-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest2.java
More file actions
91 lines (75 loc) · 2.15 KB
/
Copy pathTest2.java
File metadata and controls
91 lines (75 loc) · 2.15 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
*/
package oop.basic;
import java.util.Scanner;
/**
*
* @author sereypanha
*/
public class Test2 {
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public float getScore() {
return score;
}
public void setScore(float score) {
this.score = score;
}
private int id;
private String name,gender;
private float score;
public void Input(){
Scanner sc = new Scanner(System.in);
System.out.print("Input Id :"); id = sc.nextInt();
System.out.print("Input Name :"); name = sc.next();
System.out.print("Input Gender :"); gender = sc.next();
System.out.print("Input Score :"); score = sc.nextFloat();
}
public void Output(){
System.out.println("Output ID :"+id);
System.out.println("Output Name :"+name);
System.out.println("Outout Gender :"+gender);
System.out.println("Output Score :"+score);
}
public static void main(String[] args) {
Test2 ts = new Test2();
Scanner sc = new Scanner(System.in);
int op=0;
do{
System.out.println("1. Input ");
System.out.println("2. Output ");
System.out.println("3. Exit ");
System.out.print("Please Select One Option :");
op = sc.nextInt();
switch (op) {
case 1 -> {
ts.Input();
}
case 2 -> {
ts.Output();
}
case 3 -> {
System.exit(0);
}
}
}while(op!=3);
}
}