Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

It consists of an outer material (like glass), and an inn material(like sand) that flows through the upper chamber do below, and the width

It consists of an outer material (like glass), and an inn material(like sand) that flows through the upperInput and Output Your program should accept the following inputs from the user and display the following. 1.run of your program will look like. Program Constraints  You MUST not hardcode anything other than hardcoding

It consists of an outer material (like glass), and an inn material(like sand) that flows through the upper chamber do below, and the width of the opening between is adjusted measure the flow of time. Obviously when all of the sand h deposited into the bottom chamber the hourglass can be flipp to resume the time flow process. Your task is to design a visu version of the hourglass that can receive commands from t user, to depict the current time on a timeline. Problem Specification You will be designing an hourglass like structure (show below The size of the hourglass will remain constant. It will contain rows for the outer material, and 24 rows to house the inn material. The material used for the outer and inner may different and should be entered by the user. In the examp below, the outer material is shown using "#" and the inn material is shown using ".". The figure on the left shows the initial status of the hourgla where all of the inner material is in the upper chamber. As tir is being scrubbed, the inner material will "flow" between ea chamber to represent the current time. Time starts from 0 a updates every hour from 0-12 after which it resets back to 0 a so on. For example, the time shown on the figure on the rig shows when t= 7, as there are 7 rows of inner material deposit on the lower chamber XX Input and Output Your program should accept the following inputs from the user and display the following. 1. First, you should accept two parameters from the user, the character used to render the outer border, and the character used to render the inner material. These should be done using prompts. 2. Once you have obtained the appropriate inputs, you should display the initial clock at time t-0. This will look like the figure above (on the left). 3. Next, you should start a loop, to continually accept user inputs (using prompt) and update the clock accordingly You should accept 4 types of inputs next The next command advances the timeline by hour. Naturally, your clock should be updated to display the current time. For each next command a row of inner material should fall from the upper chamber and deposi on the lower chamber. When t-12, the subsequent nex command should imply the hourglass be flipped, and you should start back up with a full upper chamber and ar empty lower chamber. prev - The prev command rolls back time by 1 hour. Your clock should be updated to display the time accordingly i.e., a row of inner material should rise back to the upper chamber. When t = 0, the subsequent prev command should start off with a full lower chamber and an empty upper chamber nexus - The nexus command signifies a nexus event has occurred. A nexus event occurs when someone does something they are not supposed to. (chaotic alterations of a predetermined outcome). These can lead to all sorts of issues, like branched timelines, so in these cases the timeline should be reset back to t= 0. Your clock should also be updated to reset back to the starting configuration. quit - Even TVA analysts need a break. This command should exit out of your I/O loop and stop your script. run of your program will look like. Program Constraints You MUST not hardcode anything other than hardcoding the size of the clock to a variable say (N). I used N = 14, since the structure of the clock essentially is 2 inverted triangles on top of each other, with the tip of the triangles removed. So, you can design your program to render the upper half first and then the lower half. Each half will require you to have some nested loops to implement your logic. Related to above, but please make sure you are using repetition structures like for and while loops to implement the logic described in the program description. Programs that have hardcoded the display for each line will not receive ANY credit. The whole idea is to practice loops, so please make sure your code doesn't have any obvious repetitions that can be put in a loop. You are NOT allowed to use any data structures not covered in class prior to posting this assignment, so no arrays, lists or any other data structure. You don't need them.

Step by Step Solution

3.45 Rating (155 Votes )

There are 3 Steps involved in it

Step: 1

Below is a Python program that implements the hourglass clock simulation with the ability to accept ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Smith and Roberson Business Law

Authors: Richard A. Mann, Barry S. Roberts

15th Edition

1285141903, 1285141903, 9781285141909, 978-0538473637

More Books

Students also viewed these Programming questions