Posted: August 23rd, 2021

Beginner Java programming

 
I  need help with my code. can someone please help me by telling me how to fix it and explain the logic behind my errors. I don’t know if my “if” statement is correct. my program doesn’t run and I really need to learn this.

/import statement
import java.util.Scanner;
import java.lang.*;
//class variables
public class JavaCoffee {
private boolean On = (true);
private boolean Off = (false);
public JavaCoffee(boolean on,boolean off,boolean On,boolean Off){
  this.On=On;
  this.Off=Off;
  this.On=on;
  this.Off=off;
}
public JavaCoffee (boolean On){
if (On) {
System.out.println(“Brewing” );
System.out.println(” (   (“);
System.out.println(” )   )”);
System.out.println(” ………..”);
System.out.println(” |     |]”);
System.out.println(” ‘.    /”);
System.out.println(”  `—–‘”);
}
 public JavaCoffee (boolean Off){
else (Off) {
System.out.println(“***Off***”);
System.exit(0);
}
}
}
———————————————-
import java.util.Scanner;
class TestJavaCoffee{
public static void main(String[] args) {
JavaCoffee coffee = new JavaCoffee(boolean On, boolean Off);
System.out.println(“Enter On to brew coffe, or Off to power off”);
Scanner scanner = new Scanner (System.in);
String On = scanner.nextLine();
}
}

Expert paper writers are just a few clicks away

Place an order in 3 easy steps. Takes less than 5 mins.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00