Question

java code Name Customer number If a customer is new 10% is deducted and if it...


java code

Name
Customer number


If a customer is new 10% is deducted and if it is existing 5%

To register daily are $5, weekly $20, monthly $40 and annual $80

Show the cost of registration according to discount and registration type

Show the cost and a message box showing the selected alternatives

Show them in an if and errors and try catch

Homework Answers

Answer #1

//java program Show the cost of registration according to discount and registration type:

import java.util.Scanner;
public class Discountnew
{

   public static void main(String[] args)
{

       int bill,ch,cust,rcost,c;
String name;

double dis,s,amount;
Scanner in = new Scanner(System.in);
System.out.println("Enter customer Name:");
name = in.nextLine();

System.out.println("Enter customer Number:");
cust = in.nextInt();


System.out .println("Check customer is new or existing Press 1 for New Customer and Press any number for Exisiting Customer");

ch = in.nextInt();
int rtype=1;
System.out.println("\n\n 1.Register daily,Discount $5,2.Register weekly $20, 3.Register monthly $40 4. Register annual $80");
      
if(ch==1 && rtype==1)
{
System.out.println("Enter user choice:");
c= in.nextInt();
double a;
switch(c)
{

case 1:

  
dis=10; // 10 mean 10%
rcost=5; //$5

s=100-dis;
              
amount= (s*rcost)/100;

System.out.println("After discount your bill is: " + amount);
break;

case 2:

  
dis=10; // 10 mean 10%
rcost=20; //$20

s=100-dis;
              
amount= (s*rcost)/100;

System.out.println("After discount your bill is: " + amount);
break;
case 3:

dis=10; // 10 mean 10%
rcost=40; //$40

s=100-dis;
              
amount= (s*rcost)/100;

System.out.println("After discount your bill is: " + amount);
break;
case 4:

dis=10; // 10 mean 10%
rcost=80; //$80

s=100-dis;
              
amount= (s*rcost)/100;

System.out.println("After discount your bill is: " + amount);
break;

default:
System.out.println("Invalid choice");
}
}
else if(ch==2 && rtype==1)
{
System.out.println("Enter user choice:");
c= in.nextInt();
double a;
switch(c)
{

case 1:

  
dis=5; // 5 mean 5%
rcost=5; //$5

s=100-dis;
              
amount= (s*rcost)/100;

System.out.println("After discount your bill is: " + amount);
break;

case 2:

  
dis=5; // 5 mean 5%
rcost=20; //$20

s=100-dis;
              
amount= (s*rcost)/100;

System.out.println("After discount your bill is: " + amount);
break;
case 3:

dis=5; // 5 mean 5%
rcost=40;//$40

s=100-dis;
              
amount= (s*rcost)/100;

System.out.println("After discount your bill is: " + amount);
break;
case 4:

dis=5; // 5 mean 5%
rcost=80;//$80

s=100-dis;
              
amount= (s*rcost)/100;

System.out.println("After discount your bill is: " + amount);
break;

default:
System.out.println("Invalid choice");
}
}
else
{
System.out.println("Invalid choice");
}
}
}

Output:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Complete a Java program named ARMgr that maintains customer accounts receivable in a database. The code...
Complete a Java program named ARMgr that maintains customer accounts receivable in a database. The code to initialize the CustomerAccountsDB database table and add a set of customer accounts is provided. Finish the code in these 3 methods in CustomerAccountDB.java to update or query the database: -purchase(double amountOfPurchase) -payment(double amountOfPayment) -getCustomerName() Hint: For getCustomerName(), look at the getAccountBalance() method to see an example of querying data from the database. For the purchase() and payment() methods, look at the addCustomerAccount() method...
Part A. Input Validation (Name your C program yourLastName_yourFirstName_Lab4a.c) 1. Place the code you developed in...
Part A. Input Validation (Name your C program yourLastName_yourFirstName_Lab4a.c) 1. Place the code you developed in Lab 2 to obtain a diameter value from the user and compute the volume of a sphere (we assumed that to be the shape of a balloon) in a new program, and implement the following restriction on the user’s input: the user should enter a value for the diameter which is at least 8 inches but not larger than 60 inches. Using an if-else...
***Programming language is Java. After looking at this scenario please look over the requirements at the...
***Programming language is Java. After looking at this scenario please look over the requirements at the bottom (in bold) THIS IS ALL THAT WAS PROVIDED. PLEASE SPECIFY ANY QUESTIONS IF THIS IS NOT CLEAR (don't just say more info, be specific)*** GMU in partnership with a local sports camp is offering a swimming camp for ages 10-18. GMU plans to make it a regular event, possibly once a quarter. You have been tasked to create an object-oriented solution to register,...
this is the book name. Data Structures and Abstractions with Java 1) Description: The sample programs...
this is the book name. Data Structures and Abstractions with Java 1) Description: The sample programs in Chapter 1 of your textbook are not complete. They are used for illustration purpose only. The implementation of Listing 1-1 on page 39 is explained in Chapter 2. And, in order to see the result of using it, we will need the following set of files: i. BagInteface.java – the specification only. ii. ArrayBag.java – the implementation of BagInerface.java. iii. ArrayBagDemo.java – a...
for the scenario below: 1) Apply the qualitative analysis by identifying at least 3 issues in...
for the scenario below: 1) Apply the qualitative analysis by identifying at least 3 issues in the above process. Analyse these issues by using a. Adding-value and Waste Analysis b. Issue register, If you find that there are more than three issues, you can focus on the three issues that have the highest impact. 2). Calculate the cycle time efficiency of the as-is process. You can assume a working week of 40 hours. In case there is missing information, you...
Now that you have reviewed information about The Adrenaline Hut, you are ready to begin the...
Now that you have reviewed information about The Adrenaline Hut, you are ready to begin the first step in the accounting cycle, recording transactions. On this page of the practice set, you are asked to record transactions that occurred during the first week of June into the company's journals and post the appropriate entries to the ledger accounts. The following transactions occurred throughout the first week of June: Week 1 Date Transaction description 1 Issued Cheque No. 646 for $8,800...
The Business Case for Agility “The battle is not always to the strongest, nor the race...
The Business Case for Agility “The battle is not always to the strongest, nor the race to the swiftest, but that’s the way to bet ’em!”  —C. Morgan Cofer In This Chapter This chapter discusses the business case for Agility, presenting six benefits for teams and the enterprise. It also describes a financial model that shows why incremental development works. Takeaways Agility is not just about the team. There are product-management, project-management, and technical issues beyond the team’s control. Lean-Agile provides...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary rivals? How will the acquisition of Reebok by Adidas impact the structure of the athletic shoe industry? Is this likely to be favorable or unfavorable for New Balance? 2- What issues does New Balance management need to address? 3-What recommendations would you make to New Balance Management? What does New Balance need to do to continue to be successful? Should management continue to invest...
What tools could AA leaders have used to increase their awareness of internal and external issues?...
What tools could AA leaders have used to increase their awareness of internal and external issues? ???ALASKA AIRLINES: NAVIGATING CHANGE In the autumn of 2007, Alaska Airlines executives adjourned at the end of a long and stressful day in the midst of a multi-day strategic planning session. Most headed outside to relax, unwind and enjoy a bonfire on the shore of Semiahmoo Spit, outside the meeting venue in Blaine, a seaport town in northwest Washington state. Meanwhile, several members of...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how the firms resources incompetencies support the given pressures regarding costs and local responsiveness. Describe entry modes have they usually used, and whether they are appropriate for the given strategy. Any key issues in their global strategy? casestudy: Atlanta, June 17, 2014. Sea of Delta employees and their families swarmed between food trucks, amusement park booths, and entertainment venues that were scattered throughout what would...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT