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
DIA [1.3K]
4 years ago
13

Write switch-case statement that displays the following information if the temperature is the input Activities at Lake LazyDays

program: As activity directory at Lake LazyDays Resort, it is your job to suggest appropriate activities to guests based on the weather: temp p-80: swimming 60 temp 80: tennis 40 temp <60: golf temp< 40: skiing
Computers and Technology
1 answer:
Marta_Voda [28]4 years ago
3 0

Answer:

//here is code in c++.

#include <bits/stdc++.h>

using namespace std;

int main()

{

// variable

int temp;

cout<<"Please enter the temperature:";

//read temperature from user

cin>>temp;

int n;

// reduce the case for switch

n=temp/10;

// print output according to the switch case

switch (n) {

case 7:

case 6:

cout<<"tennis"<<endl;

break;

case 5:

case 4:

cout<<"golf"<<endl;

break;

default:

if(temp>=80)

cout<<"swimming"<<endl;

else

cout<<"skiing"<<endl;

break;

}

return 0;

}

Explanation:

Read the value of temperature from user and assign it to variable "temp".

Calculate n=temp/10, to limit the number of cases in the switch statement.

if temperature is greater or equal 60 & less than 80, it will print "tennis".

If temperature is greater or equal 40 & less than 60, it will print "golf".

in default case, if temperature is greater than 80, it will print "swimming".

if less than 40, print "skiing".  

Output:

Please enter  the temperature::67                                                                                        

tennis

You might be interested in
What is a header and/or a footer? The bolded subtitle for each section or the footnote on any section Text inserted into the top
USPshnik [31]

Answer:

Option B: Text inserted into the top and bottom margins.

is the correct answer.

Explanation:

Header and footer can further be defined as:

  • Data inserted in the top and bottom margin of the page.
  • This data can be the one which you want to display on each page of the document.
  • Header and footer are the optional data.
  • We can add, document name, Author name, page number etc as header and footer.
  • In order to add header and footer, go to the Insert tab.
  • Locate header/ footer group under this tab.
  • All the settings are available and can be modified easily.

i hope it will help you!

4 0
4 years ago
What can be done to reduce the occurrence of policy
natali 33 [55]
What can be done to reduce the occurence of policy?


5 0
4 years ago
What automatically created subdomain holds all the SRV records for Microsoft-hosted services, such as the global catalog, LDAP,
nevsk [136]

Answer:

The correct answer to the following question will be "_msdcs".

Explanation:

Msdcs directory known as Microsoft Domain Controller Catalog requires SRV documents that are used to identify domain controller for certain operations.

  • It automatically generated subdomain keeps all Microsoft-hosted resources SRV data, so it's the correct answer.
  • It includes common SRV documents, documents of LDAP, documents of Kpass, CNAME, etc.
7 0
4 years ago
How to change screen resolution in windows 10?
pav-90 [236]
The easiest way is to hit the Windows icon on your keyboard, look for the Settings app, and look for screen resolution in the search bar.
7 0
3 years ago
Given a list of numbers, find the correct function to find the sum of the squares of only the positive elements.
vovikov84 [41]

Answer:

sqsum4

Explanation:

So to raise a number to a power in python, you can use the ** operation, which is usually confused with the ^, which is an operation, but it is not for raising numbers to a power. It is the xor bit operation, which if you don't know at the moment, it's fine, since it's not necessary for this. each of these lists uses a generation comprehension which is generally defined as: (x for x in object if condition) with the if condition being optional, but in this case it's necessary. If it's a bit confusing, you can define a generator using a function so it's a bit more spread out:

def generator(object):

   for x in object:

       if condition:

           yield x

Although in this instance were going to be performing some operation on x, which in this case is squaring it. So let's just look at the two functions that use the **, since they should be the only options that will be correct.

sqsum1(nums):

   This function does square x, except it uses incorrect syntax. The condition should come after the for loop. Python likely wont tell you this, because it may think you're trying to do something else. You can do one line if statements like this: a if condition else b, which will return a if the condition is true, and b if it isn't. So it may think that you're trying to do this one line if statement, and say that you're missing an else. The function could even implement in this way: <em>x**2 if x > 0 else 0 for x in nums</em>. This way if the x is negative it counts as 0, or in other words isn't counted towards the sum. But without this fix, the function will raise a syntax error

sqsum4(nums):

   This will square each number in x only if the current element "x" is greater than 0, or in other words positive. And then it returns the sum. So this function returns the expected output

5 0
2 years ago
Other questions:
  • Will upvote!
    12·1 answer
  • Which tab is used to edit objects on the slide master and layouts
    10·1 answer
  • Which biometric technique is considered nearly infallible from a scientific point of view and is increasingly preferred by crimi
    8·1 answer
  • Which of the choices Sean are not true when considering virus behavior
    9·1 answer
  • Which of the following is false? A. The last element of an array has position number one less than the array size. B. The positi
    9·1 answer
  • How do computers benefit individuals' health care?
    10·1 answer
  • If you face an investigation where dangerous substances might be around, you may need to obtain which of the following?
    13·2 answers
  • In python:
    8·1 answer
  • Multitasking systems _____.
    8·1 answer
  • Describe what impact your personal vision could have your community or on society​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!