Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Tip Calculator Program

$
0
0
I'm creating a tip calculator program and I am having a few errors. This is what I have so far for my Tester class...
public class TipCalculatorTester
{	
	public static void main(String[] args)
	{
		TipCalculator Calculator = new TipCalculator();
		System.out.println("Please enter bill: ");
		TipCalculator.calculateBill();
		System.out.println("How much would you like to tip: ");
		Calculator.ShouldTip();
		Calculator.ShouldSplit();
	}
}


and this is my main class...
import java.util.Scanner;
public class TipCalculator
{
	double bill;
	double tip;
	double total;
	double split;
	double splitPrompt;
	double Y;
	double N;
	double billPerPerson;
	
		Scanner scan = new Scanner(System.in);
		public void calculateBill(double bill)
		{
			 bill = scan.nextDouble();
		}
		
		public void ShouldTip(double tip)
		{
			 tip = scan.nextDouble();
			if(tip<1)
			{
				total = bill * tip;
			}
		else total = bill * (tip/100);
		System.out.println("Your total is: " + total);
		}
		
		
		public void ShouldSplit(double splitPrompt)
		{
		System.out.println("Would you like to split the bill: ,1 for yes, 0 for No");
		splitPrompt = scan.nextDouble();
		if(splitPrompt == 0)
		{
			System.out.println("Your total is: " + total);
			System.out.println("Have a nice day");
			System.out.println("Program Terminated");	
		}
		if(splitPrompt == 1)
		{
			System.out.println("How many ways would you like to split the bill: ");
			splitPrompt = scan.nextDouble();
			billPerPerson = total/split;
			System.out.println("Each person pays: " + billPerPerson);
			System.out.println("Have a nice day");		
		}
		else System.out.println("Invalid Entry");
		}
		
	}


and I am getting an error on line 7 of my tester that says "error: method calculateBill in class TipCalculator cannot be applied to given types"

can someone help me? and thank you in advance for any help.

Viewing all articles
Browse latest Browse all 51036

Trending Articles