Homework Answers

Math 50414
Physics 44332
Chemistry 40988
Economics 30643
Programming & Computer Science 26876
Biology 8109
Engineering 6056

Questions answered by Experts: 207 418

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Write a method whatSeason(month, day) that prints out the season according to the month and day.

The month is a integer that is one of the months - like 1 to 12.

The day is an integer that is a legal day of the month - like 1 to 31.

You may assume that the month and day are “legal” values.

Winter is from 12/21 to 3/19 Spring is from 3/20 to 6/20 Summer is from 6/21 to 9/22 Fall is from 9/23 to 12/20

It should print out one of these four messages:

It is spring.
It is summer.
It is fall.
It is winter.

size1 and size2 are the sizes of two files, and space is the amount of available space on a flash drive. Write a function that takes these integer numbers as arguments and figures out the largest combination of files that fits on a flash drive. The method should return 3 if both files fit together, the file number (1 or 2) corresponding to the longest file that fits by itself (1 if the files are the same size), or 0 if neither file fits on the flash drive.

Your function must have only one return statement


Write a function called recommend(temp, forecast) that prints out a recommendation about what to wear and bring based on the weather. temp is an integer number that represents the temperature in degrees. forecast is a string which describes the weather forecast for the day.

When the temperature is under 72 degrees, a jacket should be worn.

If the forecast is “showers”, “rain”, or “snow”, an umbrella should be brought.

Your output should be one of these sentences based on the forecast & temperature.

Based on the weather forecast, you should bring a jacket and an umbrella
Based on the weather forecast, you should bring an umbrella
Based on the weather forecast, you should bring a jacket
Weather is great! Have a nice day!




def winnerRPS(me, you):

  if(me == you):

    return(0)

  if(me == "rock"):

    if(you == "scissor"):

      return(1)

    else:

      return(-1)

  if(me == "paper"):

    if(you == "rock"):

      return (1)

    else:

      return(-1)

  if(me == "scissor"):

    if(you == "paper"):

      return(1)

    else:

      return(-1)

  

   

def main():

  print(winnerRPS("rock", "paper"))

  print(winnerRPS("rock", "rock"))

  print(winnerRPS("paper", "scissor"))

  print(winnerRPS( "scissor", "paper" ) # now add your own to test it more...


if __name__ == "__main__":

  main()


Can't figure out what should go in : if __name__ == "__main__":

  main()



What will be the output of following program? Justify your answer.


#include<stdio.h>


void main()


{


int a,b,c;


a=9;


b=10;


c=(b<a||b>a);


printf(“\n c=%d”,c);


}

What will be the output of following program? Justify your answer.



#include<stdio.h>



void main()



{



int k=8,b;



b=(k++-k++-k++-k++);



printf(“\n b=%d”,b);



}

Draw a graph showing that given the supply of a goods ,the less responsive the quantity demanded is to price the greater is the share of the tax paid by consumers in the form of higher prices


What will be the output of following program? Justify your answer.


#include<stdio.h>


void main()


{


int x,y,z;


y=2;


x=2;


x=2*(y++);


z=2*(++y);


printf(“\n x=%d y=%d z=%d”,x,y,z);


}

What will be the output of following program? Justify your answer.



#include<stdio.h>



void main()



{



int m,j=3,k;



m=2*j/2;



k=2*(j/2);



printf(“\n m=%d k=%d”,m,k);



}

In a certain village 28% of all cars are made by Ford.

(ii) 14 cars are chosen randomly in this village. Find the probability that fewer than 4 of these cars are made by Ford.

(iii) A random sample of 50 cars in the village is taken. Estimate, using a normal approximation, the probability that more than 18 cars are made by Ford.


LATEST TUTORIALS
APPROVED BY CLIENTS