Programming Homework Help
CISS 110 Rutgers University Newark Java Debugging a Code
I’m stuck on a Java question and need an explanation.
/* d31.java
save as db31.java and debug the errors. There are three possibilities.
You can get a burger with fries, a burger without fries, or nothing –
you can’t just get fries. Use compound blocks where necessary.
*/
public class d31
{
public static void main(String[] args)
{
char userschoice;
double bill = 0.0;
System.out.print(“Do you want a burger? “);
System.out.print(“Enter y or n: “);
userschoice = System.in.read();
System.in.read();
if(usersChoice = ‘y’)
bill += 2.59;
System.out.print(“Fries with that burger? “);
System.out.print(“Enter y or n: “);
userschoice = System.in.read();
System.in.read();
if (userschoice = ‘y’)
bill += .89;
System.out.printf(“Bill is %.2fn”, bill);
}
}