Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Student {
- public
- String nume;
- int note1;
- int note2;
- int note3;
- float medie=(note1+note2+note3)/3;
- String grupa;
- public void setNume(String nume) {
- this.nume = nume;
- }
- public String getNume() {
- return nume;
- }
- // public void setNote(int note) {
- // this.note = note;
- // }
- public void setNote1(int note1) {
- this.note1 = note1;
- }
- public void setNote2(int note2) {
- this.note2 = note2;
- }
- public void setNota3(int nota3) {
- this.note3 = nota3;
- }
- public int getNote1() {
- return note1;
- }
- public int getNote2() {
- return note2;
- }
- public int getNota3() {
- return note3;
- }
- public void setGrupa(String grupa) {
- this.grupa = grupa;
- }
- public String getGrupa() {
- return grupa;
- }
- public void setMedie(float medie) {
- this.medie = medie;
- }
- public float getMedie() {
- return medie;
- }
- // Scanner sc=new Scanner(System.in);
- //String nume=sc.nextLine();
- // int note=Integer.parseInt(sc.nextLine());
- // String grupa=sc.nextLine();
- //float mediee=(note1 +note2 + note3)/3;
- public Student(String nume,String grupa,int nota1,int nota2,int nota3,float medie){
- //
- this.nume=nume;
- this.note1=nota1;
- this.note2=nota2;
- this.note3=nota3;
- this.grupa=grupa;
- this.medie=medie;
- }
- void Afisare(){
- float medie;
- // medie= (this.note1 +this.note2 + this.note3)/3;
- System.out.println(this.nume+" " + this.grupa + " " + this.note1 + " " + this.note2 +" " + this.note3 + " " + "media notelor este: " + this.medie);
- }
- }
- //Main
- import java.util.Scanner;
- class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- // int n=Integer.parseInt(sc.nextLine());
- //Student s1 = new Student("Alex","221/2",5,4,6 ,5);
- //Student s2 = new Student("Alexandra","223/2",9,5 ,6,6);
- //Student s3 = new Student("Cristina","224/2",9,8 , 9,8);
- //Student s4 = new Student("Larisa","222/2",9,6 , 9,8);
- //s1.Afisare();
- //s2.Afisare();
- //s3.Afisare();
- //s4.Afisare();
- System.out.print("n=");
- int n= Integer.parseInt(scanner.nextLine());
- Student []student = new Student[n];
- for (int i=1; i<=n;i++)
- {
- student[i].setNume(scanner.nextLine());
- System.out.print("nume student : ");
- System.out.println(student[i].getNume());
- }
- System.out.println();
- System.out.println(".......................................");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement