public class Receipt 
  public static void main (String[] args)
  {
    // Calculate total owed, assuming 8% tax/15% tip
    System.out.println("Subtotal:");
    System.out.println("int.Subtotal:=108");
    System.out.println("Mystring = Mystring.Replace(38+40+30,Subtotal)");
    System.out.println("Tax and Tip:");
    System.out.println((("Subtotal")*.08)+(("Subtotal")*.15));)
    System.out.println("Total:");
    System.out.println("Subtotal"+("Subtotal")*.08 +("Subtotal")*.15);
  }
}

On line 10 it's giving me the ; expected error but when i put it in it gives me a illegal start of expression error

Recommended Answers

All 2 Replies

It looks to me like your problem is with line 9:
System.out.println((("Subtotal")*.08)+(("Subtotal")*.15));)
You have an extra ) at the end.

hericles: you missed the first problem: there is no opening bracket after the class definition.

public class Receipt 
  public static void main (String[] args)
  {

should be:

public class Receipt{
  public static void main (String[] args)
  {

and, even though hericles is right about the ')' that shouldn't be there, that's the least of the problems with that line (and not only that one, but I'll use that one to illustrate):

System.out.println((("Subtotal")*.08)+(("Subtotal")*.15));)

take this part, for example:

(("Subtotal")*.08)

what exactly do you expect as return value? you want to multiply a String with a numeric value, which is not possible.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.