Question: Please solve 1b using the logical operators (OR and AND). I'm not sure how to do it. With logical operators I get: if(a==2 && a!=3

 Please solve 1b using the logical operators (OR and AND). I'm

Please solve 1b using the logical operators (OR and AND). I'm not sure how to do it.

With logical operators I get: if(a==2 && a!=3 ){ } if(a==3 || a!=2){

Is this right??

}

Make sure you input comments and formatting, please. These are must Incorrect answers or incomplete work will be flagged for a review Exercise 1. For this exercise you will write two different programs that will do the same thing. In Exercise 1a, you will program the exercise without using logical operators and in Exercise 1b, you will write the program using logical operators. Ex 1a. Write a program that computes the total cost of buying a house. If the province of sale is in Nova Scotia, Prince Edward Island or New Brunswick the sales tax is 15%; if the house is in Ontario or Quebec, the sales tax is 12% and everywhere else in Canada the the sales tax is 17%. There is 7.5% surcharge on the total cost (cost plus sales tax) to pay for the relator charges but if you are a first time house buyer the surcharge is not charged. [You need not concern yourself with the exact display of the decimal point.1 Test the program with three sets of data and include the results in this report to show all sales tax outcomes (with one showing the user to be a first time home owner). DO NOT USE THE LOGICAL OPERATORS (OR or AND) The program works as follows Cost of House S100000 House Location - 1 for Nova Scotia, Prince Edward Island, or New Brunswick 2 for Ontario or Quebec and 3 other Canadian Provinces2 Sales Tax: $12000.0 Are you a first time home buyer? Type true or false: true Surcharge: $0.0 Total cost: $112000.0 Cost of House S120000 House Location - 1 for Nova Scotia, Prince Edward Island, or New Brunswick 2 for Ontario or Quebec and 3 other Canadian Provinces 1 Sales Tax: $18000.0 Are you a first time home buyer? Type true or false: false Surcharge: $10350.0 Total cost: $148350.0 Ex 1b. For this exercise you will redo Exercise 1b using the Logical Operators OR and AND Write a program that computes the total cost of buying a house. If the province of sale is in Nova Scotia Prince Edward Island or New Brunswick the sales tax is 15%; if the house is in Ontario or Quebec, the sales tax is 12% and everywhere else in Canada the the sales tax is 17%. There is 7.5% surcharge on the total cost (cost plus sales tax) to pay for the relator charges but if you are a first time house buyer the surcharge is not charged. [You need not concern yourself with the exact display of the decimal point.] Test the program with three sets of data and include the results in this report to show all sales tax outcomes (with one showing the user to be a first time home owner). FOR THIS EXERCISE USE THIE LOGICAL OPERATORS (OR and AND)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!