Steps |
Time consuming H |
Percentage |
Demand analysis |
0.3h |
7.5 |
Design |
2.5h |
62.5 |
Code implementation |
0.5h |
12.5 |
Test |
0,2h |
5 |
Analysis Summary |
0.5h |
12.5 |
Experiment One
Experiment Two:
Experiment Three
Implement arithmetic
Code:
Import Java.util.Scanner;
public class D1_jisuanqi {
public static void Main (string[] args) {
Double x,y,s;
int i;
System.out.println ("1 is multiplication, 2 is division, 3 is addition, 4 is subtraction, 5 is modulo");
Scanner sc = new Scanner (system.in);
i = Sc.nextint ();
if (i = = 1)
{
System.out.println ("You will use multiplication");
System.out.println ("Please enter x, y two values: (with a space interval)");
Scanner C = new Scanner (system.in);
x = C.nextdouble ();
y = c.nextdouble ();
s = x*y;
System.out.println ("The value of X*y is:" +s);
C.close ();
}
else if (i = = 2)
{
System.out.println ("You will use Division");
System.out.println ("Enter the value of x, Y: (with a space interval)");
Scanner d = new Scanner (system.in);
x = D.nextdouble ();
y = d.nextdouble ();
s = x/y;
SYSTEM.OUT.PRINTLN ("x/y value is:" +s);
D.close ();
}
else if (i = = 3)
{
System.out.println ("You will use addition");
System.out.println ("Enter the value of x, Y: (with a space interval)");
Scanner e = new Scanner (system.in);
x = E.nextdouble ();
y = e.nextdouble ();
s = x+y;
System.out.println ("The value of X+y is:" +s);
E.close ();
}
else if (i = = 4)
{
System.out.println ("You will use subtraction");
System.out.println ("Enter the value of x, Y: (with a space interval)");
Scanner f = new Scanner (system.in);
x = F.nextdouble ();
y = f.nextdouble ();
s = x-y;
SYSTEM.OUT.PRINTLN ("x-y value is:" +s);
F.close ();
}
Else
{
System.out.println ("You will use modulo");
System.out.println ("Enter the value of x, Y (with a space interval)");
Scanner g = new Scanner (system.in);
x = G.nextdouble ();
y = g.nextdouble ();
s = x%y;
System.out.println ("The value of X%y is:" +s);
G.close ();
}
Sc.close ();
}
}
Package LJP;
Import Java.util.Scanner;
public class Hello {
public static void Main (string[] agrs) {
System.out.println ("Input Your first name,please:");
Scanner s =new Scanner (system.in);
String name = S.next ();
System.out.println ("Hello" +name+ "!");
}
Java Experiment One