Question

In: Computer Science

Task #1 – Software Sales A software company sells a package that retails for $99. Quantity...

Task #1 – Software Sales
A software company sells a package that retails for $99. Quantity discounts are given according to the following:
Quantity Discount
1 - 9 NO DISCOUNT
10 – 19 20%
20 – 49 30%
50 – 99 40%
100 or more 50%
Your program calculates the final purchase price of the software packages based on the quantity purchased. If a value of 0 or less (a negative number) is entered, display the message “Invalid Quantity” and end the program.
Input:
Ask the user to enter the quantity of packages purchased.
Process:
Calculate the subtotal (quantity * $99)
Apply the discount based on the discount schedule shown above.
Output:
Display the number of products purchased, the amount of the discount (if any) and the total amount of the purchase after the discount. Correctly format your output as currency ($xx.xx).
Sample User Input:
Enter the number of products purchased > 15
Sample User Output:
Your purchase of 15 products provides a quantity discount is 20%
Your total purchase price is $1198.00

Task #2 – The Bookseller
As a bookseller, you have a book club that awards points to its customers based on the number of books published each month.
The points awarded are as follows:
If the customer purchases 0 books, he/she earns 0 points
If the customer purchases 1 book, he/she earns 5 points
If the customer purchases 2 books, he/she earns 15 points
If the customer purchases 3 books, he/she earns 30 points
If the customer purchases 4 or more books, he/she earns 60 points
Write a program that asks the user to enter the number of books that he or she has purchased and then displays the number of points awarded. Use the SWITCH statement for this problem.
Input:
Prompt the user for the number of books purchased
Process:
Determine the number of points awarded based on the point schedule shown above
Output:
Display the number of points earned
Sample User Input:
Enter the number of books purchased > 1
Sample User Output:
You have earned 5 points

Task #3 – How much would you weigh on Mars
This task allows the user to determine how much they would weigh on any one of the planets in our Solar System.
How much you weigh depends on your mass, the mass of the planet, and the distance you are from the center of the planet. Since the various planets in our Solar System are different sizes, you will weigh less or more depending on the planet you are on. I will spare you some of the calculations and simplify it to: Weight = Mass x Surface Gravity
So, if you know your weight on Earth and the surface gravity on Earth, you can calculate your mass. You can then calculate your weight on any other planet by using the surface gravity of that planet in the same equation.

Process:
Read the Planet Name
Read your body mass
Using the Table of Mass shown below, calculate and display your weight using the equation:
Weight = Mass x Surface Gravity
Table of Surface Gravity for various planets
Mercury: 0.055
Venus: 0.82
Earth: 1.0
Mars: 0.11
Jupiter: 318
Saturn: 95.2
To simplify even further, I’m not giving you all of the planets in our Solar System.
In order to perform this task, you need some form of selection flow. The choice is up to you!
You will need to validate that a correct planet name was entered. Consider a mixed case entry of the planet – this is acceptable. However, misspellings are NOT acceptable.
If not, display a message indicating that the name entered was invalid and then exit the program!
Case 1:
Sample User Input for valid user input:
Enter the planet name> EArth
Enter your body mass (in pounds) > 100
Sample User Output:
Based on your body mass of 100, on the planet Earth, you would weigh 100 pounds

Case 2:
Sample User Input for invalid user input:
Enter the planet name> Earttttth
Enter your body mass (in pounds) > 100
Sample User Output:
You have entered an invalid planet name

Need this code in Java!

Solutions

Expert Solution

Please up vote ,comment if any query . Thanks for question . Be safe .

Note : check attached image for output .

Task 1 Program : ***********************************DiscountMain.java*******************************


import java.util.Scanner;


public class DiscountMain {


public static void main(String[] args) {
  
Scanner sc =new Scanner(System.in); //console read scanner object
while(true)
{
int discount=0;
System.out.print("Enter the number of products purchased > "); //prompt for number of items purchased
int itemPurchased=sc.nextInt(); //read item purchased

if(itemPurchased>=1 && itemPurchased<=9) //if 1 to 9 no discount applied
{
discount=0;
}

else if(itemPurchased>=10 && itemPurchased<=19) //if 10-19 20%
{
discount=20;
}
else if(itemPurchased>=20 && itemPurchased<=49) //if 20-49 30%
{
discount=30;
}
else if(itemPurchased>=50 && itemPurchased<=99) //if 50-99 40%
{
discount=40;
}
else if(itemPurchased>=100) //if 100>= 50%
{
discount=50;
}
else //invalid quantity
{
System.out.println("Invalid Quantity");
break;
}
//print purchase
System.out.println("Your purchase of "+itemPurchased+" products provides a quantity discount is "+discount+"%");
double totalPurchase=(itemPurchased*99)-(itemPurchased*99)*.20; //(item*99)-((item*99)*20/100)
String totalCost=String.format("%.2f", totalPurchase);//convert into string for 2 decimal places
System.out.println("Your total purchase price is $"+totalCost); //print discount
}
}
  
}

Output : Discount

Task2 Program : ****************************BookMain.java***************


import java.util.Scanner;


public class BookMain {


public static void main(String[] args) {
  
Scanner sc =new Scanner(System.in); //console read scanner object
System.out.print("Enter the number of books purchased > "); //prompt for number of books purchased
int booksPurchased=sc.nextInt(); //read books
  
//switch case for books
switch(booksPurchased)
{
case 0: //if 0 books points also 0
System.out.println("You have earned 0 points");   
break;
case 1: //1 for 5 point
System.out.println("You have earned 5 points");   
break;
case 2: //2 for 15
System.out.println("You have earned 15 points");   
break;
case 3:
System.out.println("You have earned 30 points");   
break;
default: //if 4 or more 60 points
System.out.println("You have earned 60 points");   
break;
}
  
  
  
  


}
  
}

Output : books task

Task 3 Program : **********************PlanetMain.java*******************************


import java.util.Scanner;


public class PlanetMain {


public static void main(String[] args) {
  
Scanner sc =new Scanner(System.in); //console read scanner object
  
while(true) //infinite loop
{
double weight=0.0; //declare weight
boolean exitFlag=false; //exit flag set false
System.out.print("Enter planer name >"); //prompt for planet name
String planetName=sc.nextLine(); //read name
planetName= planetName.toLowerCase();//convert it into lower case
System.out.print("Enter your body mass (in pounds)>"); //prompt for weight
double mass= Double.parseDouble(sc.nextLine()); //read as string and convert it into double
  
  
switch(planetName) //switch case for planet name
{
  
case "mercury": //for mercury
weight=mass*0.055;
break;
case "venus":
weight=mass*0.82;
break;
case "earth":
weight=mass*1.0;
break;
case "mars":
weight=mass*0.11;
break;
case "jupiter":
weight=mass*318;
break;
case "saturn":
weight=mass*95.2;
break;
default: //if invalid planet name
System.out.println("You have entered an invalid planet name."); //print error message
exitFlag=true; //set exit flag to true
break;
}
  
if(exitFlag) //break from loop
{
break;
}
  
System.out.println("Based on your body mass of "+mass+", on the planet "+planetName+", you would weigh "+weight+" pounds");
  
}
  
  
}
  
}

Output : Planet Task

Please up vote ,comment if any query .


Related Solutions

========================================================================= A software company sells a package that retails for $99. Quantity discounts are given according...
========================================================================= A software company sells a package that retails for $99. Quantity discounts are given according to the following table. Quantity Discount 10–19 20% 20–49 30% 50–99 40% 100 or more 50% Write a program that asks for the number of units sold and computes the total cost of the purchase. Input Validation: Make sure the number of units is greater than 0. ========================================================================= the pseudo code is: There comes situations in real life when we need to make some...
Software Sales A software company sells three packages, Package A, Package B, and Package C, which...
Software Sales A software company sells three packages, Package A, Package B, and Package C, which retail for $99, $199, and $299, respectively. Quantity discounts are given according to the following table: Quantity Discount 10 through 19 20% ,20 through 49 30% ,50 through 99 40% ,100 or more 50% . Create a C++ program that allows the user to enter the number of units sold for each software package. The application should calculate and display the order amounts and...
this is in excel VB8 Program 2: Software Sales A software company sells three packages, Package...
this is in excel VB8 Program 2: Software Sales A software company sells three packages, Package A, Package B, and Package C, which retail for $99, $199, and $299, respectively. Quantity discounts are given according to the following table: Quantity Discount 10 through 19 20% 20 through 49 30% 50 through 99 40% 100 or more 50% Create an application that allows the user to enter the number of units sold for each software package. The application should calculate and...
Design the logic in pseudocode for Bugz App software company that sells a software package as...
Design the logic in pseudocode for Bugz App software company that sells a software package as follows. 1. The retail price of the package is $99 2. Quantity discounts are given on purchases of 10 or more units as follows The program must allow the user to enter the customer’s name and number of units purchased, and output the original cost of the units purchased, the percentage discount given, the dollar amount of the discount given, and the final cost...
Rita Jekyll operates a sales booth in computer software trade shows, selling an accounting software package,...
Rita Jekyll operates a sales booth in computer software trade shows, selling an accounting software package, Abacus. She purchases the package from a software company for $165 each. Booth space at the convention hall costs $13,000 per show. Required a. Sales at past trade shows have ranged between 400 and 600 software packages per show. Determine the average cost of sales per unit if Ms. Jekyll sells 400, 450, 500, 550, or 600 units of Abacus at a trade show....
Big Red Computer Sales sold to Little Red Insurance Co. The following package. Initial software package...
Big Red Computer Sales sold to Little Red Insurance Co. The following package. Initial software package for         100,000 Training                                     300,000 Updates                                       50,000 Terms of the sale include initial down payment of 200,000 on date of sale of 1/1/04 and balance due 1/1/05. Software package is to be delivered and installed when down payment is made. Training is to incur over first two years and update to occur at end of first year. Prepare journal entries.
1. A shirt that retails for $120 in New York sells for £60 in London. The...
1. A shirt that retails for $120 in New York sells for £60 in London. The exchange rate between the British pound and the dollar is £1 = $1.60. You spot a profit-making opportunity and choose to exploit it by buying and selling 5,000 shirts. (35 Points) Which country would you purchase the shirts in and for how much (in their currency)? Which country would you sell the shirts in and how much would you receive in their currency? Converting...
Task 1: Investigating Hashing software and the basic usage (total 9 marks) In this task, you...
Task 1: Investigating Hashing software and the basic usage (total 9 marks) In this task, you need to find three hashing identify software or utilities regardless MS Windows and/or Linux platforms these tools can run on and provide three quick samples or procedures or steps that to show how to use this three software or utilities to identify a hash string. Three (3) marks for each software or utility named and a sample of how to identify a hash string....
Early in 2021, the Excalibur Company began developing a new software package to be marketed. The...
Early in 2021, the Excalibur Company began developing a new software package to be marketed. The project was completed in December 2021 at a cost of $102 million. Of this amount, $68 million was spent before technological feasibility was established. Excalibur expects a useful life of five years for the new product with total revenues of $170 million. During 2022, revenue of $51 million was recognized. Required: 1. Prepare a journal entry to record the 2021 development costs. 2. Calculate...
HOMEWORK 1 This assignment is designed to illustrate how a software package such as Microsoft Excel...
HOMEWORK 1 This assignment is designed to illustrate how a software package such as Microsoft Excel supplemented by an add-in such as PHStat can enable one to calculate minimum sample sizes necessary in order to construct confidence intervals for both population means and proportions and to construct these types of confidence intervals. You should use PHStat in order to accomplish all parts of this assignment. You should not only find the required information, but you should explain the meanings of...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT