Asked Nov 5, 2019

Think of one of your Math homework. How can you use program to reveal the answer? Write a calculation program with atleast ten(10) variable statements calculating a problem


Expert Answer

Step 1

A program is to be created that uses at least 10 variables to calculate a problem. Let us consider a problem of calculating total sale of seven days, average sale and Percentage sale in a week. Here 10 variables will be declared as Mon, Tue, Wed, Thur, Fri, Sat, Sun, TotalSale, AvgSale and AvgPer.

Step 2

The following java program will calculate the problem.

import java. util.*;

public class Main


   public static void main(String[] args)


       // ten variables are declared

    int Sun = 1000;

    int Mon = 1500;

    int Tue = 1200;

    int Wed = 1800;

    int Thur = 1500;

    int Fri = 800;

    int Sat = 900;

    float TotalSale;

    float AvgSale;

    float AvgPer;

    // Calculating total Sale

    TotalSale = Sun + Mon + Tue + Wed + Thur + Fri + Sat;

            System.out.println("Total Sale for the week is $" + TotalSale);


            // Calculating Average Sale

            AvgSale = TotalSale/7;

            System.out.println("Average Sale for the week is $" + AvgSale);


            // Finding Percentage Sale

            AvgPer =(AvgSale/ TotalSale)*100;

            System.out.println("Average Percentage Sale for the week is " + AvgPer);



Step 3

In the above program, 10 variables are declared as Mon, Tue, Wed, Thur, Fri, Sat, Sun, TotalSale, AvgSale and AvgPer. Then Total sale is calculated by adding sales for seven days and result is pr...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in


Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you

Show more Q&A add

Q: whats is the length of UDP?

A: The given User Datagram Protocol header is 12 03 00 0F 00 1E A3 10.The UDP (User Datagram Protocol) ...


Q: You are a new employee in the engineering organization of a large camping equipment and outdoor furn...

A: Successful implementation of Product Lifecycle Management (PLM) systemA PLM system is an information...


Q: Please Use JAVA to solve the problem

A: Create a java class “ArrayInv” and create a main method inside it.And declare a required variable to...


Q: What are the four components of php application and explain why these are so important?

A: Four components of a PHP application are the following:DatabaseHTMLSessions/Authentication/ CookiesU...


Q: How do I code this on python heres the problem  Use the Design Recipe to define a function count_val...

A: Programming instructions: Define the function count_value which takes the list and a value as an arg...


Q: I dont understand whats going on Its hard for me to read whats happening and what the output will be...

A: Click to see the answer



A: Bitcoin Value Chain can be defined with the help of three terms BlockChain, Private Keys and third M...


Q: Assignment First, launch NetBeans and close any previous projects that may be open (at the top menu ...

A: Program: public class MultiTable{public static void main(String[] args){ int i, j; System.out.print(...


Q: Suppose s is a string with the value "java". What will be assigned to x if you execute the following...

A: Given:String s = “java”;char x = s.charAt(4);