• Register
0 votes
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

7 5 3
5,380 points

Please log in or register to answer this question.

2 Answers

0 votes

Solutions:

Let me try to help you with your query.
Answer is - .04
  
Hope this might help you.
 
8 6 2
10,530 points
0 votes

Solution:

The Correct Answer of this question is A) .04

10 6 4
31,120 points

Related questions

0 votes
1 answer 197 views
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 ?
asked Feb 13, 2020 maddi86 5.4k points
0 votes
1 answer 190 views
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.
asked Mar 9, 2020 ArifulIslam 7.5k points
0 votes
1 answer 5 views
5 views
problem: I can not find out the problem of when are statements in a class-level initialization block executed?
asked Apr 6 ashik 14.6k points
0 votes
1 answer 237 views
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); } }
asked Feb 18, 2020 maddi86 5.4k points
0 votes
1 answer 5 views
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.
asked Apr 30 ochena 23.3k points
0 votes
1 answer 100 views
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?
asked Mar 6 Code Learner 9.8k points
0 votes
1 answer 4 views
4 views
Problem: How can I check if a checkbox in a checkbox array is checked using the id of the checkbox array? I am using the following code, but it always returns the count of checked checkboxes regardless of id. function isCheckedById(id) { alert(id); var checked = $("input[@id=" + id + "]:checked").length; alert(checked); if (checked == 0) { return false; } else { return true; } }
asked Apr 28 Jack20 5.1k points
0 votes
1 answer 39 views
39 views
Problem: Hello programmers! I want to know how many times will the following loop be executed? for(int i = 0; i<= 100; i = i+2) Moreover, what will be the value of &lsquo;i&rsquo; when this loop terminates? I am a beginner so I am so confused.
asked Jan 19 Code Learner 9.8k points
0 votes
1 answer 2 views
2 views
Problem: An answer for this >What would the answer to the following conversion problem be
asked 19 hours ago Chi Omega 1.9k points