1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
geniusboy [140]
3 years ago
5

This lab requires you to translate your work in the pseudocode and flowchart from Lab 2.2 and Lab 2.3 to actual code using Pytho

n. Read the following program prior to completing the lab.
A retail company must file a monthly sales tax report listing the total sales for the month and the amount of state and county sales tax collected. The state sales tax rate is 4 percent and the county sales tax rate is 2 percent. Write a program that asks the user to enter the total sales for the month. The application should calculate and display the following:
•
The amount of county sales tax
•
The amount of state sales tax
•
The total sales tax (county plus state)

Consider the following functions for your program:
•
main that calls your other functions
•
inputData that will ask for the monthly sales
•
calcCounty that will calculate the county tax
•
calcState that will calculate the state tax
•
calcTotal that will calculate the total tax
•
printData that will display the county tax, the state tax, and the total tax

If your program is correct, sample output might look as follows:

Welcome to the total tax calculator program

Enter the total sales for the month $12567
The county tax is $ 251.34
The state tax is $ 502.68
The total tax is $ 754.02
Computers and Technology
1 answer:
butalik [34]3 years ago
4 0

Answer:

// Scanner class is imported to allow program receive user input

import java.util.Scanner;

// Solution is defined

public class Solution {

   // main method is defined to begin program execution

   public static void main(String args[]) {

    // A welcome message is displayed to user    

    System.out.println("Welcome to the total tax calculator program");

   

   //  inputData is called and assigned to total_sales

    int total_sales = inputData();

   //  calcCounty is called and assigned to county_tax

    double county_tax = calcCounty(total_sales);

   //  calcState is called and assigned to state_tax

    double state_tax = calcState(total_sales);

   //  calcTotal is called and assigned to total_tax

    double total_tax = calcTotal(state_tax, county_tax);

   //  printData is called

    printData(state_tax, county_tax, total_tax);

   }

   

   // The inputData method receive input from user

   // The method returns the received input

   public static int inputData(){

       // A scan object is defined to received input

       Scanner scan = new Scanner(System.in);

       System.out.print("Enter the total sales for the month $");

       int entered_total = scan.nextInt();

       return entered_total;

   }

   

   // The calcCounty method is defined and it

   // return the county_tax

   public static double calcCounty(double total_sales){

       double county_tax = 0.02 * total_sales;

       return county_tax;

   }

   

   // The calcState method is defined and it

   // return the state_tax

   public static double calcState(double total_sales){

       double state_tax = 0.04 * total_sales;

       return state_tax;

   }

   

   // The calcTotal method is defined and it

   // return the total_tax

   public static double calcTotal(double state_tax, double county_tax){

       double total_tax = state_tax + county_tax;

       return total_tax;

   }

   

   // The printData method print out the data

  // Each data is displayed to 2 decimal place

   public static void printData(double state_tax, double county_tax, double total_tax){

       System.out.println("The county tax is $" + String.format("%.2f", county_tax));

       System.out.println("The state tax is $" + String.format("%.2f", state_tax));

       System.out.println("The total tax is $" + String.format("%.2f", total_tax));

   }

}

Explanation:

You might be interested in
Write 5 SQL query..<br>according to class 10​
sashaice [31]

Answer: A query is an inquiry into the database using the SELECT statement. These statements give you filtered data according to your conditions and specifications indicating the fields, records and summaries which a user wants to fetch from a database.

Explanation:

4 0
2 years ago
In an object-oriented approach, functions used to carry out subtasks are also called ____.
kotegsom [21]
<span>In object-oriented approach, functions used to carry out subtasks are also called "helper" functions, because they are usually used by other functions in the object to complete "sub-tasks". Functions are also known as â€methods’. When the task to be carried out by an object is complicated, it is preferable to break it into subtasks or subroutines. It is accomplished by helper functions. They may or may not accept data and may or may not return a value.</span>
6 0
4 years ago
Why was chess considered to be one of the most difficult games for computers to play well?​
telo118 [61]

Answer:

In a general sense, the answer to that is Go. The main reason for that is because the size of the board and the fact that it is empty to begin with gives the game a much more complex opening to the game. But if you were to make things equal in board size then chess is the obvious more difficult game to master.

Explanation:

6 0
3 years ago
Read 2 more answers
99 Point question
icang [17]
Smartart is your answer! Hope this helps
3 0
4 years ago
Read 2 more answers
What is RAM? explain it
Zina [86]
RAM is memory in the computer
3 0
3 years ago
Read 2 more answers
Other questions:
  • The fossilizing process that replaces organic matter with silica or calcite is:
    13·2 answers
  • _____ run horizontally and _____ run vertically in a table.
    7·1 answer
  • In which career does the level of education vary the most?
    13·2 answers
  • What is the correct method for moving a control file (assume you use PFILE)?
    14·1 answer
  • The activities that gather information about the organization and its network activities and assets is called fingerprinting. __
    14·1 answer
  • Please help due today please help me!!!!!
    15·1 answer
  • ICD-10-CM diagnosis codes are entered in Block 21 of the CMS-1500 claim. A maximum of __________ ICD-10- CM codes may be entered
    14·1 answer
  • The elements of an integer-valued array can be set to 0 (i.e., the array can be cleared) recursively as follows: An array of siz
    14·1 answer
  • WHAT DOES THE SCRATCH CODE BELOW DO?
    6·1 answer
  • Type the correct answer in each box. Spell all words correctly, and use numerals instead of words for numbers. If necessary, use
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!