Write a program that takes an integer as input, representing a year in school. Output "Elementary school" for 0-5, "Middle school" for 6-8, "High school" for 9-12, "College" for 13-16, and "Post-secondary" for 17 and higher. Output "Invalid" for negative input. If the input is 7, the output is:

Answers

Answer 1
Answer:

In python:

year = int(input("Enter the school year: "))

if 0 <= year <= 5:

   print("Elementary school")

elif 6 <= year <= 8:

   print("Middle school")

elif 9 <= year <= 12:

   print("High School")

elif 13 <= year <= 16:

   print("College")

elif year >= 17:

    print("Post-secondary")

else:

   print("Invalid")

I hope this helps!


Related Questions

Write a simple arithmetic expression translator that reads in expressions such as 25.5 + 34.2 and displays their value. Each expression has two numbers separated by an arithmetic operator. (Hint: Use a switch statement with the operator symbol (type char) as a selector to determine which arithmetic operation to perform on the two numbers. For a sentinel, enter an expression with zero for both operands.)
as a technician, you have been tasked with increasing the ram memory on a laptop by adding a so-dimm module to an empty memory slot. which of the following processes seats the module in the slot?
When emergency changes have to be made to systems, the system software may have to be modified before changes to the requirements have been approved. Suggest a model of a pro- cess for making these modifications that will ensure that the requirements document and the system implementation do not become inconsistent.
What is the main purpose of the status report? O A. To ensure that management and the team has a clear picture of the state of the project. B. To alert management to exceptional or unusual situations, C. To document the impact of change requests from the client. D. To detail the mistakes made in planning and budgeting,​
Using your choice of pseudocode, C# or java, define a class for a Pig. A Pig object should have three attributes: a name, an age, and weight. Your class should have (i) a constructor that takes three arguments and copies them to the attributes; (ii) setters (mutators) and getter accessors) or properties (C#) for the attributes; (iii) a display method to display the Pig's attributes on screen; and (iv) a main() method that creates a Pig object, assigns values to its attributes, and displays them by calling the display method.

A computer with a frequency 2 GHZ and its average cycle per instruction is 2. what is the MIPS of the computer?

Answers

Answer:

The correct answer is 1000 MIPS.

Explanation:

Using the rule of three you can solve the needed cycles to complete 1.000.000 instructions.

  • 1 instruction -> 2 cycles
  • 1.000.000 instructions -> x cycles.

1.000.000 instructions multiplied by 2 cycles, divided by 1 instruction is equal to 2.000.000 cycles to complete 1.000.000 instructions.

To find the MIPS you have to divide the frequency by the cycles needed to complete 1.000.000 instructions.

MIPS = 2GHZ / 2.000.000 cycles = 1000 MIPS.

Which of the following statements is NOT true regarding the Security Configuration and Analysis (SCA) tool?a. It evaluates the current security state of computers in accordance with Microsoft security recommendations.
b. It allows an administrator to analyze a computer and compare its configuration settings with a baseline.
c. It can apply a baseline to force current computer settings to match the settings defined in the baseline.
d. It uses security templates to store the settings that make up baselines.

Answers

Answer: a. It evaluates the current security state of computers in accordance with Microsoft security recommendations

Explanation:

The Security Configuration and Analysis tool allows the configuration of local computers through the application of the settings in a security template to the local policy.

This allows an administrator to analyze a computer and compare its configuration settings with a baseline. The Security Configuration and Analysis (SCA) tool also uses security templates to store the settings that make up baselines.

Therefore, based on the options given, the correct option is A as the SCA tool doesn't evaluate the current security state of computers in accordance with Microsoft security recommendations.

Write an application that calculates and displays the amount of money a user would have if his/her money could be invested at 5% interest for one year. Create a method that prompts the user for the starting value of the investment and returns it to the calling program. Call a separate method to do the calculation and return the result to be displayed. Save the program as Interest.java

Answers

Answer:

// Application in java.

// package

import java.util.*;

// class definition

class Main

{

  // method for calculating interest

  public static float calculateInterest(float start_bal,float i_Rate)

  {

  // calculate return

     float return_Amount=start_bal+(start_bal*(i_Rate/100));

     // return

    return return_Amount;

  }

// main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

         // scanner Object to read the input

         Scanner sc = new Scanner(System.in);

         // variables

         float start_bal;

         float i_Rate=5;

         // ask to enter start money

        System.out.print("Enter start money:");

        // read start money

        start_bal=sc.nextFloat();

        // call the function and print the return amount

        System.out.println("5% interest earned on $" + start_bal + " after one year is $" + calculateInterest(start_bal,i_Rate));

   }catch(Exception ex){

       return;}

}

}

Explanation:

Declare and initialize interest rate with 5.Then read the start money from user.Then call the method calculateInterest() with parameter start_bal and i_Rate.It will calculate the return amount after 1 year.Print the returned amount in main method.

Output:

Enter start money:1500

5% interest earned on $1500.0 after one year is $1575.0

Hardware Name:Description:
Picture:
1. Motherboard





2. Power Supply



3. CPU (Central Processing Unit)



4. Random Access Memory (RAM)



5. Hard Disk Drive/Solid State Drive



6. Video Card



7. Optical Drives



8. Input and Output Devices

Answers

Answer:

I think 2.power supply yaar

In computer programming, what is syntax?

Answers

Answer: syntax is a set of rules for grammar and spelling. In other words, it means using character structures that a computer can interpret

Answer:

in computer science, the syntax of a computer language is the set of rules that defines the combinations of symbols that are considered to be correctly structured statements or expressions on that language.

write a program that calculates the average of a group of 5 testscores, where the lowest score in the group is dropped. it shoulduse the following functionsa. void getscore() should ask the use for the test score, store itin a reference parameter variable and validate it. this functionshould be called by main once for each ofthe five score to be entered.

Answers

C++ program for calculating the average of scores

#include <iostream>

using namespace std;

const int n=5;//As per question only 5 test scores were there

int numbers[5];

void getscore(int i)//defining function for taking input

{

cin >> numbers[i];

while(numbers[i]<0 || numbers[i]>100)//score should be between 0 to 100

{

cout<<"\nThe number should be between 0 to 100\n";

cin>>numbers[i];

}

}

int main()//driver function

{

cout << "Enter 5 scores:\n";

for (int i = 0; i < n; i++)

{

getscore (i);//calling function each time for input

}

int s = 101;

double avg = 0;

for (int i = 0; i < n; i++)//loop for finding the smallest

{

s = numbers[i] < s ? numbers[i] : s;

}

for (int i = 0; i < n; i++) //loop for finding the Average

{

avg += numbers[i];

}

avg -= s;

avg /= 4;

cout << "Average of the four scores are: " << avg<< endl;//printing the output

return 0;

}

Output

Enter 5 scores:

4

5

6

7

8

Average of the four scores are: 6.5

Other Questions