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

operator * is undefined for the argument type(s) Scanner, double

$
0
0
I am trying to learn how to program in Java but I seem to be missing a detail here. I am trying to multiply two doubles to get a third double. I am not sure what the error means or how to correct it. All I have found online are references to libraries or vectors, but I have not learned those yet. Any help would be greatly appreciated. The code is below:

	public static void main(String[] args) {
		//Greeting
		System.out.println("Welcome to the Earnings Calculator");
		double base = 100000;  //Base Salary
		System.out.print("Current salary calculations based on base salary of ");
		System.out.println(base);
		//User sales input
		System.out.print("Enter your total sales ");
		Scanner salesTotal = new Scanner (System.in);
		System.out.println(salesTotal.nextLine());
		//Commission Calculation
		double commissionRate = 0.05; //Commission Rate
		double commission;
		commission = salesTotal * commissionRate;
		System.out.println(commission);
		
	}



Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>