Reference no: EM13778479
1. Based on the code below, answer these questions (identify line numbers for Java statements):
Which line(s) will be executed if the condition in line 3 is true?
Processing then will proceed to which line?
Which line(s) will be executed if the condition in line 3 is false?
Processing will then proceed to which line?
Line 10 will always be executed whether line _____ is true or false.
Lines 5-6 will only be executed when line ______ is ____________.
Line 9 will only be executed when line ______ is ____________.
1 double purchasesYTD = 200.0;
2 double discount = 0.0;
3 if(purchasesYTD>= 200.00)
4 {
5 System.out.printf("%nUse this promo code on your next purchase ME09X1.");
6 discount = .10;
7 }
8 else
9 System.out.printf("%nPlease check our daily specials.");
10 System.out.printf("%nYou qualify for a %.0f%% discount.", discount);
2. Re-code the IF/ELSE structure in lines 3-9 above so the else statement is now the if statement. HINT: The condition tested should be reversed.
3. Use printf() with format specifiers as needed. Code on this page the following:
a. Code an if statement that prints "I got the promotion!". The if condition tests the boolean variable promotion which is already declared.
b. Given a boolean variable called inactive,use the conditional operator (ternary operator) to assign ‘Y' to the variable closeAcct; otherwise, assign‘N'. Assume both variables are already declared.
c. Write an if-else statement that assigns 2 extra credit points for an 80% class attendance rate, 3 extra credit points for an 85% class attendance rate, and 5 extra credit points for anything 90% and above. Assume extraCreditand attendancearealready declared. Make sure you scope the code properly
d. Code a while loop that keeps printing "You are a DEDICATED student!" as long as the user enters an attendance rate of 90% or greater. Assume the loop-control variable, attendance, is already declared along with input for the Scanner class. The while loop requires a priming read for the loop-control variable prior to entering the loop.
e. There are 20 students. Code a while loop that processes extra credit points for student attendance. Use the if/else coded in 3c. Print "Sorry, you've not earned any extra credit for your attendance." or "Congratulations! You've earned 9extra credit points because of your good attendance." where the 9 is the actual number of points earned based on the if/else from 3c. Assume the input variable for the Scanner class, the attendanceand extraCreditvariables are already declared. Declare the loop-control variable.
Describe how the sox act may affect ethical decision
: Write a 350- to 700-word review of the article. Your review should discuss how the SOX Act may affect ethical decision making in today's business environment, and the criminal penalties for which the act provides
|
Arrested for assaulting
: Two men were arrested for assaulting each other in what would be called a "bar brawl." The bar owner did not press charges, and the two men were released.
|
State of decision making and problem diagnosis
: Which of the steps in the formal planning process involves studying past events, examining current conditions, and forecasting future trends?
|
Stereotypes set by culture and society
: Sociology came into existence in the 19th century to explain the enormous changes occasioned by the Industrial Revolution, urbanization, and an individualistic mind-set. Unlike agrarian communities, the emerging urban populations were large, numbe..
|
Java coding if-else while loop
: Code a while loop that keeps printing "You are a DEDICATED student!" as long as the user enters an attendance rate of 90% or greater. Assume the loop-control variable, attendance, is already declared along with input for the Scanner class. The w..
|
Strongly counter-intuitive consequences
: Review the Food Environment Atlas maps for variables that seem to affect your selected state the most. Select a state and variables you consider relevant to represent the food environment in you chosen state.
|
Meaningfulness of a correlation coefficient
: What is the coefficient of determination? Why is it important to know the amount of shared variance when interpreting both the significance and the meaningfulness of a correlation coefficient?
|
How to create both method contract and method specification
: Your demonstrations of how to create both method contract and the method specification for the GetCourseByCourseID() method of the CourseList class were very well received by your team members
|
When making basic marks and marginal comments
: When making basic marks and marginal comments, which strategy is LEAST helpful? Which of the following steps do not help writers develop research topics into appropriate lines of inquiry?
|