I need help debugging this program for calculating a persons tip:
public class calculatetip
{
public static void main(String[] args)
{
double mycheck = 29.95, yourcheck = 39.95, mytip, yourtip;
System.out.println("Tips are");
calctip(double mycheck);
System.out.printf("My tip should be at least %.2f\n", tip);
calctip(double yourcheck);
System.out.printf("Your tip should be at least %.2f\n", tip);
}
public static void calctip()
{
double tip;
tip = bill * .20;
return tip;
}
}
1
Expert's answer
2015-07-23T01:54:06-0400
public class calculatetip { public static void main(String[] args) { double mycheck = 29.95, yourcheck = 39.95, mytip, yourtip; System.out.println("Tips are"); mytip = calctip(mycheck); System.out.printf("My tip should be at least %.2f\n", mytip); yourtip = calctip(yourcheck); System.out.printf("Your tip should be at least %.2f\n", yourtip); }
public static double calctip(double bill) { double tip; tip = bill * .20; return tip; } }
Comments
Leave a comment