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
1 year 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]1 year 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
The type of current that flows from the electrode across the arc to the work is called what?
Scrat [10]

Answer:

Direct current.

Explanation:

5 0
3 years ago
Lets Try This: study the pictures. Describe what you see and think about it. write your answer on a sheet of paper. home room
Yuliya22 [10]

Answer: I see three children cleaning the lawn while one of them are raking the leaves and one is holding a dust pan. The other child is holding a bucket. On the other picture, i see a young boy watering plants.

BTW: these pictures are not very clear so answers may vary.

Explanation:

4 0
3 years ago
A crude fermenter is set up in a shed in the backyard of a suburban house. Under anaerobic conditions with ammonia as the nitrog
Aleks04 [339]

Answer:

using calculations Heat losses will be 4512 J

5 0
4 years ago
assume a five layer network model. There are 700 bytes of application data. There is a 20 bye header at the transport layer, a 2
amm1812

Answer: The overhead percentage is 7.7%.

Explanation:

We call overhead, to all those bytes that are delivered to the physical layer, that don't carry real data.

We are told that we have 700 bytes of application data, so all the other bytes are simply overhead, i.e. , 58 bytes composed by the transport layer header, the network layer header, the 14 byte header at the data link layer and the 4 byte trailer at the data link layer.

So, in order to assess the overhead percentage, we divide the overhead bytes between the total quantity of bytes sent to the physical layer, as follows:

OH % = (58 / 758) * 100 = 7.7 %

4 0
3 years ago
Air entrainment is used in concrete to: __________.
Dahasolnce [82]

The answer is number 2) Increase the resistance of the concrete to freeze-thaw damage.

5 0
3 years ago
Other questions:
  • Question 11 (1 point)
    12·1 answer
  • ____ technologies are new technologies that are not currently widely employed.
    15·2 answers
  • A cylinder with a piston restrained by a linear spring contains 2 kg of carbon dioxide at 500 kPa and 400°C. It is cooled to 40°
    7·1 answer
  • What competitive strategy was used by Regal Marine?
    5·1 answer
  • Drag each label to the correct location on the chart. Classify the organisms based on how they obtain food.
    14·2 answers
  • Limestone scrubbing is used to remove SO2 in a flue gas desulfurization (FGD) system. Relevant reactions are given below. A lime
    8·1 answer
  • The only way to know if a design will work in real-world conditions is to build a model, or prototype, based on the plan. This i
    7·2 answers
  • Find the mean deviation of the set of numbers<br> (a) 12, 6, 7, 3, 15, 10, 18,5
    7·2 answers
  • The sum of forces on node 2 (upper-left) is ______.
    11·1 answer
  • It is possible to design a reactor where the scy conductor and the nitrogen/ammonia electrode operate at different temperatures.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!