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
MrMuchimi
2 years ago
6

For this assignment, you will write a program to determine the time and date corresponding to an elapsed number of seconds since

00: 00: 00 on 1 January 2020. Have the user input the value of elapsed seconds. The output (to the screen) should be the corresponding hour (in military time), minute, second, day of the month, month name, year, and day of the week name (Sunday – Saturday). Your output should be formatted like the following:23:59:32 2 January 2021 SaturdayDon’t forget that a leap year has 366 days with 29 days in February. Leap years are years that are evenly divisible by 4, with the exception of those evenly divisible by 100, but those divisibly by 400 are leap years.Your program should be accomplished using the assignment operator (=), mathematical operators ( +,-,/,*,^), basic logical operators and functions (&,|,~,xor), basic relational operators and functions ( ==, <, <=, strcmp), decision making and repetition constructs (if-elseif-else, switch-case-otherwise, for, while), and input/output functions we've learned (e.g. input, display, sprintf, fprintf). To determine whether a number is evenly divisible, you are also allowed to use the built-in matlab remainder (rem, mod) and rounding (floor, fix, round) functions. No other built-in matlab functions are allowed.
Engineering
1 answer:
Karolina [17]2 years ago
3 0

A Python program should be written to produce output that corresponds to the given hour, minute, second, day of the month, month's name, year, and day of the week's name.

present_year=2016

present_month="January"

present_date="1"

present_day="Friday"

present_hour=0

present_minute=0

present_second=0

input<-from user(seconds)//taking imput from the user using Python program

   total_seconds=input

   //checking with seconds

   if(total_seconds<60)

       present_second+=total_seconds

   else

       total_minutes=total_seconds/60

       remaining_seconds=total_seconds-total_minutes*60

       present_second+=remaining_seconds

   //checking with minutes

   if(total_minutes<60)

       present_minute+=total_minutes

   else

       total_hours=total_minutes/60

       remaining_minutes=total_minutes-total_hours*60

       present_minute+=remaining_minutes

   //checklng with hours

   if(total_hours<24)

       present_hour+=total_hours

   else

       total_days=total_hours/24

       remaining_hours=total_hours-total_days*24

       present_hour+=remaining_hours

   //checking with days

   total_weeks=total_days/7

   remaining_day=total_days-total_weeks*7

   switch(remaining_day)

       case 1:

           present_day="Friday"

       case 2:

           present_day="Saturday"

       case 3:

           present_day="Sundayday"

       case 4:

           present_day="Monday"

       case 5:

           present_day="Tuesday"

       case 6:

           present_day="Wedday"

       case 7:

           present_day="Thursday"

   //checking with years    

   if(total_days>366)

       while(total_days)

           if(present_year%4==0)

               total_days-=366

               present_year+=1

           if(present_year%4!=4)

               total_days-=365

               present_year+=1

           if(present_year%4!=0&&total_days<365)

               break;

           if(present_year%4==0&&total_days<366)

               break;

   //checking with months and date

   if(total_days<=366)

       while(total_days)

           if(present_month="January")

               present_date++

               total_days--

               if(present_date==31)

                   present_month="February"

                   present_date=0

           if(present_month="February")

               present_date++

               total_days--

               if(present_date==28&&present_year%4!=0)

                   present_month="March"

                   present_date=0

               if(present_date==29&&present_year%4==0)

                   present_month="March"

                   present_date=0

           if(present_month="March")

               present_date++

               total_days--

               if(present_date==31)

                   present_month="April"

                   present_date=0        

           if(present_month="April")

               present_date++

               total_days--

               if(present_date==30)

                   present_month="May"

                   present_date=0        

           if(present_month="May")

               present_date++

               total_days--

               if(present_date==31)

                   present_month="June"

                   present_date=0        

           if(present_month="June")

               present_date++

               total_days--

               if(present_date==30)

                   present_month="July"

                   present_date=0    

           if(present_month="July")

               present_date++

               total_days--

               if(present_date==31)

                   present_month="August"

                   present_date=0    

           if(present_month="August")

               present_date++

               total_days--

               if(present_date==31)

                   present_month="September"

                   present_date=0        

           if(present_month="September")

               present_date++

               total_days--

               if(present_date==30)

                   present_month="October"

                   present_date=0    

           if(present_month="October")

               present_date++

               total_days--

               if(present_date==31)

                   present_month="November"

                   present_date=0    

           if(present_month="November")

               present_date++

               total_days--

               if(present_date==30)

                   present_month="December"

                   present_date=0

           if(present_month="December")

               present_date++

               total_days--

               if(present_date==31)

                   present_month="January"

                   present_date=0

//printing present time

print present_hour:present_minute:present_second present_date present_month present_year present_day          

Learn more about Python program here:

brainly.com/question/28691290

#SPJ4          

You might be interested in
You could be sued if you injure someone while rescuing them if...
navik [9.2K]
I believe number 4 I could be wrong but I think it’s 4
3 0
3 years ago
Read 2 more answers
Differnce between boussinesqs and westergards theory of stress distribution of soil?​
arlik [135]
Boussinesq's influence factor is high Westergaard's theory:- 1. ) Assumes that the soil medium is anisotropic 2) Deals with thin sheets of rigid material sandwiched in a homogeneous medium. ... 5) Westergaard's influence factor is low compare to Boussinesq's influence factor.
7 0
2 years ago
A bar having a length of 5 in. and cross-sectional area of 0.7 i n . 2 is subjected to an axial force of 8000 lb. If the bar str
barxatty [35]

Answer:

E=1.969 × 10¹¹ Pa

Explanation:

The formula to apply is;

E=F*L/A*ΔL

where

E=Young modulus of elasticity

F=Force in newtons

L=Original length in meters,m

A=area in square meters m²

ΔL= Change in length in meters,m

Given

F= 8000 lb = 8000*4.448 =35584 N

L= 5 in = 0.127 m

A= 0.7 in² =0.0004516 m²

ΔL = 0.002 in = 5.08e-5 m

Applying the formula

E=(35584 * 0.127)/(0.0004516*5.08e-5 )

E=1.969 × 10¹¹ Pa

8 0
4 years ago
If you know that the change in entropy of a cup of coffee where heat was added is 20 J/K, and that the temperature of the coffee
Anna35 [415]

Answer:

5000J

Explanation:

Given in the question that

Heat added to the coffee cup is, ΔS = 20 J/K

The temperature of the coffee, T = 250 K

Now, using the formula for the entropy change

\bigtriangleup S=-\frac{\bigtriangleup H}{T} ...........(1)

Where,

ΔS is the entropy change

ΔH is the enthalpy change

T is the temperature of the system

substituting the values in the equation (1)

we get

20=-\frac{\bigtriangleup H}{250}

ΔH=250×20

ΔH=5000 J

6 0
3 years ago
the left rear brake drum is scored, but the right rear drum looks as good as new. technician a says the left-side drum should be
Romashka-Z-Leto [24]

Technician b is correct because the left rear brake drum is scored, but the right rear drum looks as good as new then both sides should be remachined to a similar diameter.

A brake drum is a revolving cylinder-shaped component that is friction-activated by a set of shoes or pads pressing outward against it. Drum brakes are brakes where shoes are pressed against the inner surface of the drum. Drum brakes are frequently used at the rear. Compared to disc brakes, these brakes have more parts and are more difficult to maintain, but they cost less to make and are simple to add an emergency braking mechanism. The front and rear brakes are standard equipment on all automobiles. Your car may have a "disc brake" system on all four wheels, a "drum brake" system on all four wheels, or a combination of the two. Typically, the front brakes of your car have a disc system, and the rear brakes have a drum system.

Learn more about brake drum here:

brainly.com/question/14937026

#SPJ4

7 0
1 year ago
Other questions:
  • Which one? Sam Golbach or Colby Brock
    5·2 answers
  • What instrument is used to measure temperature?
    10·1 answer
  • EJERCICIO 6
    15·1 answer
  • An eddy current separator is to separate aluminum product from an input streamshredded MSW. The feed rate to the separator is 2,
    7·1 answer
  • 4. From two permeability tests it is found that the void ratio and hydraulic conductivity of a normally consolidated clay are 1.
    15·1 answer
  • Once the ideas were narrowed down and divided into categories, the group was split into four smaller teams. What phase(s) of the
    11·1 answer
  • me that both a triaxial shear test and a direct shear test were performed on a sample of dry sand. When the triaxial test is per
    5·1 answer
  • If a client is shown the "Cadillac"
    11·1 answer
  • A 100 MHz generator with Vg= 10/00 v and internal resistance 50 ohms air line that is 3.6m and terminated in a 25+j25 ohm load
    6·1 answer
  • If weather conditions are such that it is required to designate an alternate airport on your IFR flight plan, you should plan to
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!