Can you find a hidden arrow on the screen? There are 4 questions in this slide show. But you have to find the button to see them all :).

Search

sfolax6776

Oct 8, 2018

C5 - Else if and Switch - more tools to create branches

11 comments

Edited: Oct 15, 2018

Can you find a hidden arrow on the screen? There are 4 questions in this slide show. But you have to find the button to see them all :).

0

New Posts

- sfolax677613 hours agoA. Introduction A valid credit card number will yield a result divisible by 10 when you: Form the sum of all digits. Add to that sum every second digit, starting with the second digit from the right. Then add the number of digits in the second step that are greater than four. The result should be divisible by 10. For example, consider the number 4 0 1 2 8 8 8 8 8 8 8 8 1 8 8 1. The sum of all digits is 89. The sum of the bold digits is 46. There are five bold digits larger than four, so the result is 89+46+5=140. 140 is divisible by 10 so the card number is valid. B. Write your code to check if a credit card number is valid or not according to the rules above. You need to verify if the input is a 12-digit number.
- sfolax677614 hours agoA Introduction A drunkard in a grid of streets randomly picks one of four directions and stumbles to the next intersection, then again randomly picks one of four directions, and so on. You might think that on average the drunkard doesn’t move very far because the choices cancel each other out, but that is not the case. B Your task: Represent locations as integer pairs (x, y). Implement the drunkard’s walk over 100 intersections, starting at (0, 0), and print the ending location.
- sfolax67764 days agoA. Introduction Before we start learning computer programming, let's take a minute to understand what a computer is and have you ever wondered what are inside a computer? B. Watch ( Slides ) C. Try: there are many questions at end of chapter 1 of this book . See if you can do at least two of R1.2 - R1.4, E1.1-E1.3

I found the arrow in 2 seconds

R5.2 the second one includes an else if, but the first one only includes and if.

R5.4 a. m b. n c. error d. error

you have to import the math file

use your brains and figure it out with your brain!

R5.3 a. uhhh why is there a "then". b. missing a ) c. missing a = at "if (x = 1) d. what the heck is in.hasNextInt? e. must be else if, not if.

In the first one, it both has if. In the second one, the second piece of code has else if

R5.2) The first code has both if statements but the second code has one if and an else if statement

R5.4) a. m b. n c. error d. error

R5.3) a. It says then which it shouldn't b. It didn't close the brackets c. There has to be double = signs d. In the if statement the String is not the same as the x String e. There is no default statement in the code.

I didn't get the last one so yea...

a is m, b is n, and c and d is error

My bad I didn't see the double

R5.2: The second one has else if, not if.

R5.4: 1. m 2.n 3.error 4. error

R5.3: a. there shouldn't be a "then" b. the brackets aren't closed so yeah c. there is no System.out.println at y++; d. same as c and no brackets on sum = sum + x e. no place for F

4.

https://repl.it/@Brainseater905/UntidyFrivolousAddonhttps://repl.it/@DaveyYu/Homework-for-102118