hi pooo pwede pong patulongg? ganito po kasiii, ahm di po ako makagaw ng program sa java na may parameters na random numbers gagamitin, random rn = new Random
ano po ba mali dito?
import java.util.Random;
import java.util.Scanner;
public class forloop {
{
}
public static void main(String[] args) {
int a=0;
int b=0;
int c=0;
int d=0;
Scanner input = new Scanner(System.in);
Addme();
Printperimeter();
Printanswer();
}
{
System.out.println("Note: Find the perimeter of the trapezoid by using the formula perimeter = a + b + c + d .");
for (int x=1; x<=10; x++){
System.out.println("\nProblem # " +x);
}
}
}
static void Addme() {
Random rn = new Random();
a = rn.nextInt(100);
System.out.println("a= " +a);
b = rn.nextInt(100);
System.out.println("b= " +b);
c = rn.nextInt(100);
System.out.println("c= " +c);
d = rn.nextInt(100);
System.out.println("d= " +d);
}
static void Printperimeter() {
System.out.print("What is the perimeter? ");
perimeter = input.nextInt();
int correct_ans= a + b + c + d;
}
static void Printanswer() {
if(perimeter == correct_ans)
System.out.println("You are correct");
else
System.out.println("Your answer is wrong");
}
}
please po patulong, di ako makatulog :<
ano po ba mali dito?
import java.util.Random;
import java.util.Scanner;
public class forloop {
{
}
public static void main(String[] args) {
int a=0;
int b=0;
int c=0;
int d=0;
Scanner input = new Scanner(System.in);
Addme();
Printperimeter();
Printanswer();
}
{
System.out.println("Note: Find the perimeter of the trapezoid by using the formula perimeter = a + b + c + d .");
for (int x=1; x<=10; x++){
System.out.println("\nProblem # " +x);
}
}
}
static void Addme() {
Random rn = new Random();
a = rn.nextInt(100);
System.out.println("a= " +a);
b = rn.nextInt(100);
System.out.println("b= " +b);
c = rn.nextInt(100);
System.out.println("c= " +c);
d = rn.nextInt(100);
System.out.println("d= " +d);
}
static void Printperimeter() {
System.out.print("What is the perimeter? ");
perimeter = input.nextInt();
int correct_ans= a + b + c + d;
}
static void Printanswer() {
if(perimeter == correct_ans)
System.out.println("You are correct");
else
System.out.println("Your answer is wrong");
}
}
please po patulong, di ako makatulog :<