clean proj
This commit is contained in:
parent
127427b305
commit
4678933c30
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<projectDescription>
|
<projectDescription>
|
||||||
<name>LAB1</name>
|
<name>Project_C03_GOL</name>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
|
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
import java.io.*;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class : Keyboard
|
|
||||||
* Description : The class implements input methods for primitive types from the keyboard.
|
|
||||||
*/
|
|
||||||
public class Keyboard {
|
|
||||||
/**
|
|
||||||
* Return a String typed on keyboard
|
|
||||||
* @return : a string
|
|
||||||
*/
|
|
||||||
public String readString() {
|
|
||||||
String sChaine = null;
|
|
||||||
//System.out.println("Enter a value :");
|
|
||||||
try {
|
|
||||||
// read the value
|
|
||||||
BufferedReader brLecteur ;
|
|
||||||
brLecteur = new BufferedReader(new InputStreamReader(System.in));
|
|
||||||
sChaine = brLecteur.readLine();
|
|
||||||
}
|
|
||||||
catch (IOException ee) {
|
|
||||||
System.out.println("Error");
|
|
||||||
}
|
|
||||||
return sChaine; // return the string
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return an Integer typed on keyboard
|
|
||||||
* @return : an integer
|
|
||||||
*/
|
|
||||||
public int readInt() {
|
|
||||||
String sChaine = readString(); // call readString
|
|
||||||
// cast from string to int
|
|
||||||
return Integer.parseInt(sChaine.trim());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a float typed on keyboard
|
|
||||||
* @return : a float
|
|
||||||
*/
|
|
||||||
public float readFloat() {
|
|
||||||
String sChaine = readString();
|
|
||||||
// cast from string to float
|
|
||||||
return Float.parseFloat(sChaine.trim());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a double typed on keyboard
|
|
||||||
* @return : a double
|
|
||||||
*/
|
|
||||||
public double readDouble() {
|
|
||||||
String sChaine = readString();
|
|
||||||
// cast frome string to double
|
|
||||||
return Double.parseDouble(sChaine.trim());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
public class Main {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
//Robot robo = new Robot();
|
|
||||||
//robo.sayHello();
|
|
||||||
//robo.sayHello2("Lola");
|
|
||||||
|
|
||||||
// RobotCalculator robo = new RobotCalculator();
|
|
||||||
// robo.average(15.0,5.0);
|
|
||||||
// RobotCalculator b = new RobotCalculator();
|
|
||||||
// b.askUserForNbOfStudent();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
public class Robot {
|
|
||||||
public void sayHello() {
|
|
||||||
System.out.println("Hello");
|
|
||||||
}
|
|
||||||
public void sayHello2(String name) {
|
|
||||||
System.out.println("Hello "+ name);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
public class RobotCalculator {
|
|
||||||
|
|
||||||
public double average(double grade1, double grade2) {
|
|
||||||
double avg = (grade1 + grade2)/2;
|
|
||||||
return avg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void askUserForNbOfStudent() {
|
|
||||||
System.out.println("Give me the number of student");
|
|
||||||
Keyboard input = new Keyboard();
|
|
||||||
int nStudents = input.readInt();
|
|
||||||
double sum = 0 ;
|
|
||||||
for(int i=1;i<=nStudents;i++) {
|
|
||||||
System.out.println("Give me the fisrt grade");
|
|
||||||
double grade1 = input.readDouble();
|
|
||||||
System.out.println("Give me the second grade");
|
|
||||||
double grade2 = input.readDouble();
|
|
||||||
RobotCalculator robo = new RobotCalculator();
|
|
||||||
double StudentAvg = robo.average(grade1,grade2);
|
|
||||||
sum = sum + StudentAvg ;
|
|
||||||
System.out.println(StudentAvg);
|
|
||||||
}
|
|
||||||
System.out.println(sum/nStudents);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
|
|
||||||
public class Test {
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue