![davestrider404](/avatars/18343.jpg)
davestrider404
12.02.2020 •
Computers and Technology
The point of this exercise is to (1) use some of the arithmetic
operators, and (2) start thinking about compound entities (like time of day)
that are represented with multiple values.
1. Create a new program called Time.java. From now on, we won’t remind
you to start with a small, working program, but you should.
2. Following the example program in Section 2.4, create variables named
hour, minute, and second. Assign values that are roughly the current
time. Use a 24-hour clock so that at 2pm the value of hour is 14.
3. Make the program calculate and display the number of seconds since
midnight.
4. Calculate and display the number of seconds remaining in the day.
5. Calculate and display the percentage of the day that has passed. You
might run into problems when computing percentages with integers, so
consider using floating-point.
6. Change the values of hour, minute, and second to reflect the current
time. Then write code to compute the elapsed time since you started
working on this exercise.
Solved
Show answers
More tips
- C Computers and Internet How to Delete a Page on VKontakte: The Ultimate Guide from Experts...
- S Style and Beauty 5 Tips for Choosing the Best Ugg Boots...
- H Health and Medicine How to Treat the Flu: A Comprehensive Guide...
- H Health and Medicine Effective Ways to Treat Colic in Infants...
- C Computers and Internet IMHO: What is it, why is it important, and how to use it?...
- F Food and Cooking How to Calculate the Gender of Your Child with Blood?...
- S Style and Beauty How to Get Rid of Under Eye Bruises?...
- C Cities and Countries What time does the Metro open in Moscow?...
- W Work and Career Where can you learn to be a flight attendant?...
- H Health and Medicine What are Electronic Cigarettes? The Ultimate Guide...
Answers on questions: Computers and Technology
- C Computers and Technology Just ignore this please...
- C Computers and Technology Assume that the following code segment C is executed on a pipelined architecture that will cause data hazard(s): Code segment C: add $s2, $t2, $t3 sub $t4, $s2,...
- H History The selective service act was a means of a. getting money to support the war effort. b. getting women to take over jobs formerly done by men. c. drafting young...
- M Mathematics What s the area of this polygon?...
- C Chemistry Give two examples in your everyday experience where diffusion occurs. can you think of a situation of where this might be harmful?...
- H History How, where and why did colonisation by european empires take place and what was its impact?...
- E English Use the table to make a graph and to write an equation i got the graph just dont know how to get the equation...
- E English The first step in researching your topic is to determine what you already know. how might what you know get in the way of doing good research? how might you check...
- P Physics José has a monthly budget of $80 to put toward his hobby of building model trains. he can afford to pay cash for his purchases, but he uses his credit card to buy...
- E English Read this passage from the exposition of “the monkey’s paw.” what is not an example of information the author is giving the reader? hark at the wind, said mr. white,...
Ответ: