subject

Assign to the variable boolean 'primeSecond' the value true if the second leading (just after the most significant) decimal digit of the value of an int variable 'n' is 2,3,5 or 7; otherwise assign 'primeSecond' the value false. Assume 'primeSecond' and 'n' are already declared and that 'n' has already been assigned a value. So if n's value is 58047 primeSecond will be false because the second leading digit of 58047 is 8 which is not 2 or 3 or 5 or 7. Instructor's notes: Hint: Use loops and division (/) and modulus (%).import java. util. Scanner; public class Test { public static void main(String [] args) { Scanner input = new Scanner(System. in); boolean primeSecond = false; System. out. print("Number: "); String num = input. nextLine(); if(num. length() > 1) { if(num. charAt(1) == '2' || num. charAt(1) == '3' || num. charAt(1) == '5' || num. charAt(1) == '7') { primeSecond=true; } } if(primeSecond) System. out. println("PrimeSecond=true"); else System. out. println("PrimeSecond=false"); } }

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:10
Which activity should be part of a long-term plan to positively affect yourhealth? oa. wearing regular clothing when handling toxinsob. not worrying about secondhand smokeoc. avoiding excessive exposure to sunlightod. drinking only well water
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
Awide variety of “ apps “ are available to customize devices. which category of app does the word processing software fall into?
Answers: 2
question
Computers and Technology, 23.06.2019 07:00
You need a quick answer from a coworker. the most effective way to reach your coworker is through a. cloud server b. instant message c. teleconference d. telepresence
Answers: 1
question
Computers and Technology, 23.06.2019 08:30
Based on your knowledge of a good network, describe what you think is a perfect network would be. what kind of information and resources could users share on this network. what would the network administrator do? what kind of communication would be used?
Answers: 1
You know the right answer?
Assign to the variable boolean 'primeSecond' the value true if the second leading (just after the mo...
Questions
question
Computers and Technology, 23.11.2020 22:20
question
Social Studies, 23.11.2020 22:20
question
Mathematics, 23.11.2020 22:20
question
Physics, 23.11.2020 22:20
Questions on the website: 13722362