
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Help me fix my code to my java problem assignment please
What is wrong with my code?
The assignment is called Interstate highway numbers in zybooks 3.24 for Java
Im trying to get my code
200 is not a valid interstate highway number.
As my answer
Instead I’m getting
I-200 is auxiliary, serving I-0, going east/west.
As the answer
Help me fix that one problem with my code thank you

Transcribed Image Text:1: JAVA Pro X
O Program Help : cprogramming
Content
Content
ECHCCCSC151TeterSpring2022/chapter/3/section/24
g home > 3.24: LAB: Interstate highway numbers
Your output
I-290 is auxiliary, serving I-90, going east/west.
3: Invalid (0) ^
1/1
Input
Your output
0 is not a valid interstate highway number.
4: Compare output a
0/1
Output differs. See highlights below.
Special character legend
Input
200
Your output
I-200 is auxiliary, serving I-0, going east/west.
Expected output
200 is not a valid interstate highway number.
5: Compare output a
2/2
Input
5
Your output
I-5 is primary, going north/south.
2/2
6: Compare output a
Input
405
Your output
I-405 is auxiliary, serving I-5, going north/south.
2/2
7: Compare output a
Input
1000
立
![151: JAVA Prc X
O Program Help : cprogramming
Content
Content
YTECHCCCSC151TeterSpring2022/chapter/3/section/24
ing home > 3.24: LAB: Interstate highway numbers
354532 2042412 qzay7
LAB
3.24.1: LAB: Interstate highway numbers
ACTIVITY
9/10
LabProgram.java
Load default template...
1 import java.util.Scanner;
2
3 public class LabProgram {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int highwayNumber;
int primaryNumber;
4
6.
7
8
9.
highwayNumber = scnr.nextInt();
10
%3D
11
12
primaryNumber - highwayNumber % 100;
13
14
if ((highwayNumber > 0) && (highwayNumber < 100))
{
if (highwayNumber % 2 -- 0)
{
System.out.println("I-" + highwayNumber + " is primary, going east/west.");
}
else
15
16
17
18
19
20
21
{
System.out.println("I-" + highwayNumber + " is primary, going north/south. ");
}
22
23
24
25
else if ((highwayNumber > 99) && (highwayNumber < 1000))
if (highwayNumber % 2 == 0)
{
System.out.println("I-" + highwayNumber + " is auxiliary, serving " + "I-" + primaryNumber + ", going eas
26
27
28
29
30
31
else
32
{
System.out.println("I-" + highwayNumber + " is auxiliary, serving " + "I-" + primaryNumber + ", going nor
}
else if ((highwayNumber < 1) || (highwayNumber > 999))
{
System.out.println(highwayNumber + " is not a valid interstate highway number.");
33
34
35
36
37
38
39
40
41
42 }](https://content.bartleby.com/qna-images/question/6961aa18-8474-4466-bd14-b02bea60c27d/7344fbf3-88f8-44f9-849d-54a8bac2edcd/lea15eb_thumbnail.jpeg)
Transcribed Image Text:151: JAVA Prc X
O Program Help : cprogramming
Content
Content
YTECHCCCSC151TeterSpring2022/chapter/3/section/24
ing home > 3.24: LAB: Interstate highway numbers
354532 2042412 qzay7
LAB
3.24.1: LAB: Interstate highway numbers
ACTIVITY
9/10
LabProgram.java
Load default template...
1 import java.util.Scanner;
2
3 public class LabProgram {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int highwayNumber;
int primaryNumber;
4
6.
7
8
9.
highwayNumber = scnr.nextInt();
10
%3D
11
12
primaryNumber - highwayNumber % 100;
13
14
if ((highwayNumber > 0) && (highwayNumber < 100))
{
if (highwayNumber % 2 -- 0)
{
System.out.println("I-" + highwayNumber + " is primary, going east/west.");
}
else
15
16
17
18
19
20
21
{
System.out.println("I-" + highwayNumber + " is primary, going north/south. ");
}
22
23
24
25
else if ((highwayNumber > 99) && (highwayNumber < 1000))
if (highwayNumber % 2 == 0)
{
System.out.println("I-" + highwayNumber + " is auxiliary, serving " + "I-" + primaryNumber + ", going eas
26
27
28
29
30
31
else
32
{
System.out.println("I-" + highwayNumber + " is auxiliary, serving " + "I-" + primaryNumber + ", going nor
}
else if ((highwayNumber < 1) || (highwayNumber > 999))
{
System.out.println(highwayNumber + " is not a valid interstate highway number.");
33
34
35
36
37
38
39
40
41
42 }
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
Similar questions
- Java Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A,B,C,D,E" is correct. Each question has one correct answer. Thank you. Part 1 - 3. Assume that "cal" is an instance of the java.util.Calendar class, which can return the current time of this Calendar in Milliseconds? A. System.out.println(cal.getTime());B. System.out.println(cal.getTimeInMillis());C. System.out.println(cal.getMillis());D. System.out.println(cal.getMillisTime());E. System.out.println(cal.getTimeMillis()); Part 2 - 4. Assume that "cal" is an instance of the java.util.Calendar class, which can set the month to February? A. cal.set(Calendar.MONTH, 1);B. cal.set(Calendar.MONTH, 2);C. cal.set(Calendar.MONTH, 3);D. cal.set(Calendar.MONTH, Feb);E. cal.set(Calendar.MONTH, February);arrow_forwardHelp me slove this in Java, don't make it too complicated.arrow_forwardTHIS IS MEANT TO BE IN JAVA. What we've learned so far is variables, loops, and we just started learning some array today. The assignment is to get an integer from input, and output that integer squared, ending with newline. But i've been given some instructions that are kind of confusing to me. Please explain why and please show what the end result is. Here are some extra things i've been told to do with the small amount of code i've already written... Type 2 in the input box, then run the program so I can note that the answer is 4 Type 3 in the input box instead, run, and note the output is 6. Change the output statement to output a newline: System.out.println(userNumSquared);. Type 2 in the input box Change the program to use * rather than +, and try running with input 2 (output is 4) and 3 (output is now 9, not 6 as before). This is what I have so far... import java.util.Scanner; public class NumSquared {public static void main(String[] args) {Scanner scnr = new…arrow_forward
- Hello! I need some help with my Java homework. Please use Eclipse Please add comments to the to program so I can understand what the code is doing and learn Create a new Eclipse project named so as to include your name (eg smith15 or jones15). In this project, create a new package with the same name as the project. In this package, write a solution to the exercise noted below. Implement the following method that returns the maximum element in an array: public static <E extends Comparable<E>> E max(E[] list) Write a test program that generates 10 random integers, invokes this method to find the max, and then displays the random integers sorted smallest to largest and then prints the value returned from the method. Max sure the the last sorted and returned value as the same!arrow_forwardJava, i have the RNG code already only the RandomNumberGenerator step that I need help with.arrow_forwardPlease help me with this. Read what is asked carefully Yes or no does the java tic tac toe gui game on the website (java gui tic tac toe codespeedy) have a searching g algorithm or search java code. Please do not write the code unto Bartleby. I just need a yes or no answer and the why or why not in simple sentencesarrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY