1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lesechka [4]
3 years ago
10

Primary U.S. interstate highways are numbered 1-99. Odd numbers (like the 5 or 95) go north/south, and events (like the 10 or 90

) go east/west. Auxiliary highways are numbered 100-999, and service the primary highway indicated by the rightmost two digits. Thus, I-405 services I-5, and I-290 services I-90. Given a highway number, indicate whether it is a primary or auxiliary highway. If auxiliary, indicate what primary highway it serves. Also indicate if the (primary) highway runs north/south or east/west.

Computers and Technology
2 answers:
Norma-Jean [14]3 years ago
4 0

Answer:

The C code for the problem is given below

Explanation:

#include <stdio.h>

int main() {

   int highwayNumber;

   int primaryNumber;

   scanf("%d", &highwayNumber);

   if (highwayNumber >= 1 && highwayNumber <= 999) {

       if (highwayNumber <= 99) {

           if (highwayNumber % 2 == 0) {

               printf("I-%d is primary, going east/west.\n", highwayNumber);

           } else {

               printf("I-%d is primary, going north/south.\n", highwayNumber);

           }

       } else {

           primaryNumber = highwayNumber;

           highwayNumber %= 100;

           if (highwayNumber % 2 == 0) {

               printf("I-%d is auxiliary, serving the I-%d, going east/west.\n", primaryNumber, highwayNumber);

           } else {

               printf("I-%d is auxiliary, serving the I-%d, going north/south.\n", primaryNumber, highwayNumber);

           }

       }

   } else {

       printf("%d is not a valid interstate highway number.\n", highwayNumber);

   }

   return 0;

}

poizon [28]3 years ago
4 0

Answer:

CODE IN C++:

#include <iostream>

using namespace std;

int main()

{

int inputNumber ;

cout << "Enter an interstate highway number:";

cin >> inputNumber ;

if(inputNumber<=0 || inputNumber >= 1000)

cout << inputNumber << " is not a valid interstate highway number" << endl ;

else{

if(inputNumber > 99){

cout << "I-"<<inputNumber<< " is auxiliary, ";

int temp = inputNumber % 100 ;

cout <<"serving I-"<<temp<<", ";

if(temp%2==0){

cout << "going east/west." << endl;

}

else{

cout << "going north/south." << endl;

}

}

else{

cout << "I-"<<inputNumber<< " is primary, ";

if(inputNumber%2==0){

cout << "going east/west." << endl;

}

else{

cout << "going north/south." << endl;

}

}

}

return 0;

}

OUTPUT:

[ find attachment ]

You might be interested in
Is USA TestPrep a test-taking site that won't let you access other windows without kicking you off?
olga_2 [115]

Answer:

usatestprep literally just does what the name says; it prepares you for tests in america. it doesn't kick you off if you access other windows

Explanation:

3 0
4 years ago
You are setting up your Windows computer to connect to the Internet and notice that when you type www.microsoft, the browser doe
Lunna [17]

Answer:

DNS

Explanation:

The DNS, also known as the Domain Name System is regarded as the internet's phonebook. It is through this medium that information is access online using domain names such as www.microsoft.com. While web browsers can communicate via IP addresses, the Domain Name System (DNS) translate the www.microsoft.com to the IP addresses in order to help the browsers load the resources on the internet. In a case where an error message is received, then the DNS network setting will show you the address of the server to resolve the issue.

5 0
4 years ago
A file can be safed with a different file name then it currently has by clicking on save ? in the file tab
Mazyrski [523]

Answer:

Click the File tab. Click Save As. Choose a file location, such as OneDrive or This PC to store your file.

Explanation:

click the File tab. Click Save As. Choose a file location, such as OneDrive or This PC to store your file. In the File name box, enter a new name for the file. In the Save as type list, click the file

5 0
2 years ago
Create an ArrayList of Employees (contain id and name) and add 3 Employees to the ArrayList to start. Next, you want to sort the
Anna [14]

Answer:

Kindly note that, you're to replace "at" with shift 2 as the brainly text editor can't accept the symbol

Explanation:

Java code:

import java.util.*; public class Employees { // variables private int id; private String name; // getters public String getName() { return name; } public int getId() { return id; } // constructor public Employees(int id, String name) { this.id = id; this.name = name; } // comparator function based on the name static class compareByName implements Comparator<Employees> { "at"Override public int compare(Employees emp1, Employees emp2) { return emp1.getName().compareTo(emp2.getName()); } } // clone method for arraylist public static ArrayList<Employees> clone(ArrayList<Employees> arr) { ArrayList<Employees> temp = new ArrayList<Employees>(); for(int i=0;i<arr.size();i++) temp.add(arr.get(i)); return temp; } // main method public static void main(String[] args) { Scanner scan = new Scanner(System. in); // reading 3 employees details ArrayList<Employees> arr = new ArrayList<Employees>(); for(int i=0;i<3;i++) { System.out.print("Enter id: "); int id = scan. nextInt(); System.out.print("Enter name: "); scan. nextLine(); String name = scan. nextLine(); arr.add(new Employees(id,name)); } // cloning and sorting ArrayList<Employees> cloneArray = clone(arr); Collections. sort(arr, new compareByName()); // printing System. out. println("Array after cloning: "); for(int i=0;i<cloneArray. size();i++) { System.out.println(cloneArray. get(i). getId() + " " + cloneArray. get(i).getName()); } System. out. println("Array after sorting: "); for(int i=0;i<arr.size();i++) { System. out. println(arr.get(i). getId() + " " + arr.get(i). getName()); } } }  

Kindly check the attached images below for the code screenshot and code output.

3 0
3 years ago
RAM IS often referred
miss Akunina [59]
3

thank me later :))))))))
7 0
3 years ago
Other questions:
  • When you reboot your system, the computer follows start-up instructions stored in this type of memory. multiple choice dram sdra
    15·2 answers
  • Which opera component is a solo performance
    10·2 answers
  • Discuss two things you want to know about driving
    12·1 answer
  • 2. Write a program with a function that accepts a string as an argument and returns a copy of the string with the first characte
    11·1 answer
  • Write code to complete PrintFactorial()'s recursive case. Sample output if userVal is 5:5! = 5 * 4 * 3 * 2 * 1 = 120
    8·1 answer
  • In the legend of sleeping Hallow what does Ichabod Crane fear the most
    13·2 answers
  • when files on storage are scattered throughout different disks or different parts of a disk, what is it called
    10·1 answer
  • What are the steps involed in accepting all the changes in a document?
    8·1 answer
  • On what type of network can you rent things such as cars, tools, and rooms?
    7·1 answer
  • What is the factor of 200
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!