# What would be the value of discountrate after the following statements are executed?

42 views

## Problems:

I am new to programming, I need help, can anyone help me?
What would be the value of discountRate after the following statements are executed?
``````double discountRate = 0.0;
int purchase = 1250;
char cust = 'N';
if (purchase > 1000)
if (cust == 'Y')
discountRate = .05;
else
discountRate = .04;
else if (purchase > 750)
if (cust == 'Y')
discountRate = .04;
else
discountRate = .03;
else
discountRate = 0;``````

a) .04

b) .03

c) .05

d) 0

## Related questions

197 views
Problems: What will be the value of x after the following code is executed? int x, y = 4, z = 6; x = (y++) * (++z); A) 24 B) 28 C) 30 D) 35 I am new to programming , Can anyone help me ?
190 views
Problem: What will be the value of x after the following code is executed? int x = 10, y = 20; while (y < 100) { x += y; } A) 90 B) 110 C) 210 D) This is an infinite loop.
5 views
problem: I can not find out the problem of when are statements in a class-level initialization block executed?
237 views
Problem: I am new in programming and when running below code getting some unexpected error, can anyone help me with right result after running this code? Given the following code, what will be the value of finalAmount when it is displayed? public class Order { ... getOrderAmount() - order.getOrderAmount() * order.getOrderDisc(); System.out.println("Final order amount = \$" + finalAmount); } }
5 views
Problem: According to my teacher, a for-loop always executes at least once, even if the condition is not met. Example (like I know it from C++): for (int i=6; i <=5; i++) { //irrelevant for this question } According to her, this loop would execute at least ... about for loops, not do-while-loops. Edit: Thanks for all those quick answers, I guess this case is already closed. Have a nice day/night.
100 views
Problem: Please tell me the correct answer: Which of the following statements are true regarding the hidden input field: It is used by the user to enter the data. It is used by the server to store data. It is used by the web-developer to add data hidden from users. There exist no hidden input fields in HTML. Moreover, how can we make a field hidden in HTML, if exist?