Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

/asks the user to first enter the name of the salesperson and stor it is variabl

ID: 3543746 • Letter: #

Question

/asks the user to first enter the name of the salesperson and stor it is variable salesmanName
//ask the user how many cars the salesperson sold that monthv and store it in variable soldCars
//Calculate the salesperson's bonus based on bonus = soldCars*1000 and store it in variable bonus
//Display on the screen the name of the sales person and the bonus they received


import java.util.Scanner;
import java.lang.String;

public class hw33
{
  
public static void main (String[] args)
  {
      Scanner keyboard =
new Scanner(System.in);
      
     
//declare variables
      String salesmanName;  
      
int soldCars;
      
double bonus;
      
      
//get inputs and store in variable  
      System.out.println("What is the name of the Sales Person?");
      salesmanName = keyboard.next();
          
      System.out.println(
"How many cars did "+salesmanName+" sell this month?");
      soldCars = keyboard.nextInt();
      
      
//calculate the bonus
      bonus = soldCars * 1000;
      
      System.out.println(salesmanName+
"'s bonus for the month is $"+bonus+".");
   }
}

Explanation / Answer

Its very easy, actually you are not using Scanner correctly.

For taking String as an Input,

salesmanName = keyboard.nextLine();