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
Sunny_sXe [5.5K]
3 years ago
8

Write a program which prompts the user to enter a number of seconds and then reports the number of years, days, hours, and minut

es the number represents.
Please enter a number of seconds: 65000000000 [Enter] 65000000000 seconds is approximately 2061 years, 49 days, 19 hours, 33 minutes and 20 seconds.


Demonstrate the program using: 65000000000, 123456789, and 987654321 (One screen shot for each)

Computers and Technology
1 answer:
Elena-2011 [213]3 years ago
3 0

Answer:

time = float(input(" Input Time in Seconds: "))

years = time // (365*24*60*60)

time = time % (365*24*60*60)

day = time // (24*3600)

time = time % (24*3600)

hour = time // 3600

time = time % 3600

minutes = time // 60

time = time % 60

seconds = time

print(years,"years")

print(day, "days")

print(hour, "hours")

print(minutes, "minutes")

print(seconds, "seconds")

Explanation:

The code is written in python programming language.

Line 1: time = float(input(" Input Time in Seconds: "))

prompts the user to input a time in seconds.

The value inputted is taken through the remaining steps.

Line 2: years = time // (365*24*60*60)

converts seconds into years and floor division is used to ensure that the result is an integer with noting after the decimal (no remainder).

Line 3: time = time % (365*24*60*60)

modulo division is used to get the remainder (seconds that were not converted to years) and then passes the output as the "New" time.

Line 4: day = time // (24*3600)

converts the "New" time to days and floor division is used to ensure there's noting after the decimal.

line 5: time = time % (24*3600)

modulo division is used to get the remainder (seconds that were not converted to days) and then passes the output as the "New" time.

line 6: hour = time // 3600

converts the "New" time to hours and floor division is used to ensure there's noting after the decimal.

line 7: time = time % 3600

modulo division is used to get the remainder (seconds that were not converted to hours) and then passes the output as the "New" time.

line 8: minutes = time // 60

converts the "New" time to minutes and floor division is used to ensure there's noting after the decimal.

line 9: time = time % 60

modulo division is used to get the remainder (seconds that were not converted to hours) and then passes the output as the "New" time.

line 10: seconds = time

It passes the remaining seconds to seconds

The last section of the code outputs the answer in years, days, hours minutes and seconds

print(years,"years")

print(day, "days")

print(hour, "hours")

print(minutes, "minutes")

print(seconds, "seconds")

You might be interested in
Explain the reason why vector graphics are highly recommended for logo​
Verdich [7]

Answer:

Currently, raster (bitmap files) and vector graphics are used in web design. But if you want to make a great logo and fully enjoy the use of it you should pick vector graphics for it in the first place. And this is why most designers opt for it.

Explanation:

  • Easier to re-edit
  • No image distortion
  • It is perfect for detailed images
  • Vector drawings are scalable
  • Vector graphics look better in print
7 0
4 years ago
Give five functions of Windows​
Nata [24]

Answer:

Explanation:

It knows how to remember data and where to find that data. In other words, it knows how the raw memory works. (RAM).

It understands how to make a program run within the confines of its logical steps in an order that makes the program work the way the user intends.

It can be made to display short cuts, or any icon or picture (not an obvious talent).

It can search for unwanted intruders like ads or viruses.

It can can time events even to the point of getting your coffee ready for you with the proper add on.

6 0
3 years ago
A customer comes into a grocery store and buys 8 items. Write a PYTHON program that prompts the user for the name of the item AN
Dmitrij [34]

Answer:

name = []

price = []

for i in range(0,8):

item_name = input('name of item')

item_price = input('price of item')

name.append(item_name)

price.append(item_price)

for i in range(0, 8):

print(name[i], '_____', price[i])

Explanation:

Python code

Using the snippet Given :

Apples 2.10

Hamburger 3.25

Milk 3.49

Sugar 1.99

Bread 1.76

Deli Turkey 7.99

Pickles 3.42

Butter 2.79

name = []

price = []

#name and price are two empty lists

for i in range(0,8):

#Allows users to enter 8 different item and price choices

item_name = input('name of item')

item_price = input('price of item')

#user inputs the various item names and prices

#appends each input to the empty list

name.append(item_name)

price.append(item_price)

for i in range(0, 8):

print(name[i], '_____', price[i])

# this prints the name and prices of each item from the list.

3 0
3 years ago
In this assignment, you will design and create an ArrayList-based application that manages a collection of DVDs. Information abo
sergij07 [2.7K]

Create and design an arraylist based application which manages a DVDs collection.

Explanation:

DVD movie consists of a title, a rating (e.g. PG, R, etc.), and a running time in minutes.

In this project, you will create an application to allow the user to maintain a collection of DVD movies using an array.

When the application starts up, it will read in the DVD data from a text file to initialize the array, if the file is available. If the file is not there, then the program starts with an empty array. If the file is corrupted (has an invalid or missing value), then the program stops its initialization at the point of the error. The data file should contain one DVD per line, with title followed by rating followed by running time in minutes, all separated by commas. You may assume titles are all in uppercase and do not contain commas. For example:

ANGELS AND DEMONS,PG-13,138

STAR TREK,R,127

UP,PG,96

The titles may not be in alphabetical order, but the DVDs should be inserted into the array in alphabetical order.

The application will then allow its user to perform the following operations:

ADD OR MODIFY DVD - The user will be prompted to enter the title, rating and running time (in minutes) for a DVD. If the title is already in the array, then the rating and running time are updated to the supplied values. If the title is not in the array, a DVD is added to the array so that the array is sorted by title. Convert all titles to uppercase only.

REMOVE DVD - The user will be prompted to enter the title of a DVD. If the title is in the array, then the DVD is removed, shifting subsequent DVDs over one position to fill in the gap left by the removed DVD. Again, titles must match exactly (in uppercase).

GET DVDs BY RATING - The user will be prompted to enter a movie rating (e.g. PG). This operation displays a string containing all DVDs matching the given rating in the order that they appear in the DVD collection, separated by newline characters.

GET TOTAL RUNNING TIME - This operation displays the total running time of all DVDs in the collection for the user.

SAVE & EXIT - The user can quit the program, performing an automatic save if the DVD collection has been modified.

Java Files

DVD.java - A class to model a single DVD, including its title, rating and total running time.

DVDCollection.java - A class to model a collection of DVDs using an array.

DVDUserInterface.java - An interface that describes the operation required for any user interface to this DVD collection.

DVDGUI.java - A class that implements the DVDUserInterface interface and provides a graphical user interface to the DVD collection.

DVDConsoleUI.java - A class that implements the DVDUserInterface interface and provides a console user interface to the DVD collection.

DVDManager.java - A class that contains a main method that launches one of the two user interfaces for the user to work with the DVD collection based on the user input.

Complete the DVD class by completing the given methods (constructor, accessors and mutators). Add javadoc comments so you can generate a javadoc documentation file showing how to use this class.

The DVDCollection class uses an array to maintain the collection of DVDs. The DVDs should be stored in alphabetical order based on title starting at position 0 in the array, using adjacent cells. All titles should be stored in uppercase only and are assumed to be unique (no duplicates).

toString - returns a string containing all of the DVDs in the collection, separated by newlines characters, along with the value of numdvds and the length of the DVD array for debugging purposes. The string should be formatted as shown in the example below:

numdvds = 3

dvdArray.length = 7

dvdArray[0] = ANGELS AND DEMONS/PG-13/138min

dvdArray[1] = STAR TREK/R/127min

dvdArray[2] = UP/PG/96min

addOrModifyDVD - given the title, rating and running time of a DVD, add this DVD to the collection if the title is not present in the DVD collection or modify the DVD's rating and running time if the title is present in the collection.insert the DVD so that all DVDs are in alphabetical order by title.

removeDVD - given the title, this method should remove the DVD with this title from the collection if present. The title must match exactly (in uppercase). If no title matches, do not change the collection.

getDVDsByRating - given the rating, this method should return a string containing all DVDs that match the given rating in the order that they appear in the collection, separated by newlines.

getTotalRunningTime - this method should return the total running time of all DVDs in the collection. If there are no DVDs in the collection, return 0.

loadData - given a file name, this method should try to open this file and read the DVD data contained inside to create an initial alphabetized DVD collection.

save - save the DVDs currently in the array into the same file specified during the load operation, overwriting whatever data was originally there.

7 0
3 years ago
Suppose you have a 16-bit machine with a page size of 16B. Assume that any unsigned 16-bit integer can be a memory address. Also
irinina [24]

Answer:

2^11

Explanation:

Physical Memory Size = 32 KB = 32 x 2^10 B

Virtual Address space = 216 B

Page size is always equal to frame size.

Page size = 16 B. Therefore, Frame size = 16 B

If there is a restriction, the number of bits is calculated like this:  

number of page entries = 2^[log2(physical memory size) - log2(n bit machine)]

where

physical memory size = 32KB  which is the restriction

n bit machine = frame size = 16

Hence, we have page entries = 2^[log2(32*2^10) - log2(16)] = 2ˆ[15 - 4 ] = 2ˆ11

7 0
4 years ago
Other questions:
  • What role do career pathways play?
    11·2 answers
  • True or false? when intel places a sticker on computers showing their chip is inside, they are demonstrating their visible value
    7·1 answer
  • Remember for a moment a recent trip you have made to the grocery store to pick up a few items. What pieces of data did the Point
    15·1 answer
  • What do you call the physical, touchable, materials parts of a computer system?
    7·1 answer
  • Please help me with opinions, ideas, any websites that would help, or chart, article, video, or podcast to help support your pos
    10·1 answer
  • Which of the following is the best definition of a computer code? a secret language a mathematical language a language that comp
    10·2 answers
  • List at least 5 professions for people working in the Information/Communication<br> fields.
    10·1 answer
  • Who watches the show gravity falls, if you do, if you play the theme song for the first episode backwards you get a hiding messi
    11·2 answers
  • The most widely used computer device​
    6·2 answers
  • I need help on this, need answer asap.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!