Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A large company pays its salespeople on a commission basis. The salespeople each receive $200 per week plus 9% of their gross sales for that

A large company pays its salespeople on a commission basis. The salespeople each receive $200 per week plus 9% of their gross sales for that week. For example a salesperson who sells $5000 worth of chemicals in a week receives $200 plus 9% of $5000, or total of $650. Develop a Java application that inputs one salesperson's items sold for last week and calculates and displays that salesperson's earnings. There's no limit to eh number of items that can be sold.

//This is what I have, I am not sure if I answered this correctly. Can someone look over this and help me? Are my variables named correctly, my professor is a real stickler about them. Thanks.

import java.util.Scanner;

public class Sales { public static void main(String args[]) { Scanner input = new Scanner(System.in); double gross = (0.0); int product = (0); double earnings = gross; int number = product;

while (product < 4) { product++; System.out.println("Enter number sold of product #" + product + ":"); number = input.nextInt(); if (product == 1) gross = gross + number * 239.99; else if (product == 2) gross = gross + number * 129.75; else if (product == 3) gross = gross + number * 99.95; else if (product == 4) gross = gross + number * 350.89; }

earnings = 0.09 * gross + 200; String result = ("Earnings this week: $" + earnings); System.out.println(result); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago