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
Blocks A and B each have a mass m. Determine the largest horizontal force P which can be applied to B so that A will not move re
slava [35]

Answer:

The answer is "15 N".

Explanation:

Please find the complete question in the attached file.

In frame B:

For just slipping:

\to \frac{P}{2} \cos \theta =mg \sin \theta\\\\\to P=2 mg \tan \theta \\\\

        =2 \times 1 \times  g \times \tan 37^{\circ}\\\\ =2 \times 10 \times  \frac{3}{4}\\\\ =15 \ N

4 0
3 years ago
Now that we have a second enemy, you will need to make some changes to the script that is attached to your backdrop. Look at tha
JulsSmile [24]

Answer:

<u><em>≡</em></u>

Explanation:

8 0
3 years ago
an object of mass 2kg is released from a top of inclined plane 30° and height 6m. The coefficient of kinetic friction of the sur
mel-nik [20]

Explanation:

1) Work done = force x distance x cos(θ)

= 0.15 x 6 x cos(30)

= 0.779

2) Ek = ½mv²

v = acceleration due to gravity so 9.81

Ek = ½(2)(9.81)²

Ek = 96.2361

3) v = (√(2em)) / m

= (√(2(96.2361)(2)) / 2

= 9.81 so especially with no time given, I can only assume the acceleration due to gravity but take it with a pinch of salt.

5 0
2 years ago
In a website browser address bar, what does “www” stand for?
Ludmilka [50]

Answer:

www stands for world wide web

Explanation:

It will really help you thank you.

3 0
3 years ago
If E = 94.2 mJ of energy is transferred when Q = 1.66 C of charge flows through a circuit element, what is the voltage across th
Anni [7]

Answer:

V = 56.8 mV

Explanation:

When a current I flows across a circuit element, if we assume that the dimensions of the circuit are much less than the wavelength of the power source creating this current, there exists a fixed relationship between the power dissipated in the circuit element, the current I and the voltage V across it, as follows:

P = V*I

By definition, power is the rate of change of energy, and current, the rate of change of the charge Q, so we can replace P and I, as follows:

E/t = V*q/t ⇒ E = V*Q

Solving for V:

V = E/Q = 94.2 mJ /1.66 C = 56.8 mV

6 0
3 years ago
Other questions:
  • Please help!!
    7·2 answers
  • A 1.5-m-long aluminum rod must not stretch more than 1 mm and the normal stress must not exceed 40 MPa when the rod is subjected
    12·1 answer
  • A local reaction is when a chemical enters the bloodstream?
    5·1 answer
  • Pick one product an engineer would build the basic knowledge of engineering(6that would be used and the product development and
    8·1 answer
  • Discuss why TVET Institutions need advice of the business community in order
    9·1 answer
  • Tamara has received multiple bids from general contractors to install a new pool in her backyard. How should she go about select
    5·1 answer
  • Does anyone know obamas last name???? please help its for a friend I swear!!!111!!11!
    8·1 answer
  • two students were talking student a was examining the lettuce leaves in a salad he was eating . he said, did you know im eating
    12·1 answer
  • I need help with the question
    12·1 answer
  • Define waves as it applies to electromagnetic fields
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!