Biblioteca Java - Blame information for rev 4
Subversion Repositories:
Rev | Author | Line No. | Line |
---|---|---|---|
4 | mihai | 1 | package oop.catalog; |
2 | import java.io.*; | ||
3 | |||
4 | public class Meniu { | ||
5 | Catalog catalog = new Catalog(); | ||
6 | |||
7 | |||
8 | void afiseaza(){ | ||
9 | System.out.println("Optiuni"); | ||
10 | System.out.println("1 - Adauaga elev"); | ||
11 | System.out.println("2 - Afiseaza lista elevi"); | ||
12 | System.out.println("3 - Caluleaza media"); | ||
13 | System.out.println("4 - Iesire"); | ||
14 | System.out.println("--------------------------"); | ||
15 | } | ||
16 | |||
17 | void citesteOptiunea() throws Exception{ | ||
18 | BufferedReader consola = new BufferedReader(new InputStreamReader(System.in)); | ||
19 | boolean activ = true; | ||
20 | do{ | ||
21 | afiseaza(); | ||
22 | System.out.println("Introduceti optiunea [Apoi Enter]"); | ||
23 | String o = consola.readLine(); | ||
24 | if(o.equals("1")) | ||
25 | { | ||
26 | System.out.println("Introduceti numele:"); | ||
27 | String n = consola.readLine(); | ||
28 | System.out.println("Introduceti nota:"); | ||
29 | String s = consola.readLine(); | ||
30 | int nota = Integer.parseInt(s); | ||
31 | Elev e = new Elev(n,nota); | ||
32 | |||
33 | catalog.adauga(e); | ||
34 | } | ||
35 | if(o.equals("2")){ | ||
36 | catalog.afisare(); | ||
37 | } | ||
38 | if(o.equals("3")){ | ||
39 | double media = catalog.calculMedia(); | ||
40 | System.out.println("Media din catalog este:"+media); | ||
41 | } | ||
42 | if(o.equals("4")) | ||
43 | activ = false; | ||
44 | }while(activ); | ||
45 | } | ||
46 | |||
47 | public static void main(String[] args)throws Exception{ | ||
48 | Meniu m = new Meniu(); | ||
49 | m.citesteOptiunea(); | ||
50 | } | ||
51 | } |