import enum
# Using enum class to create enumerations
class TrafficSignal(enum.Enum):
RED = 30 #providing 30secs of Red Light
YELLOW = 3 #providing 3secs of Yellow Light
GREEN = 45 #providing 45secs of Green Light
WALK = 20 #providing 20secs to Walk
DONT_WALK = 50 #providing 50secs not to Walk
for status in TrafficSignal: #looping through all the
enums
print (status.name ,":", status.value,"secs")#displaying enums on
terminal
Enum Write an enum type called TrafficSignal, which contains the constants RED, GREEN, YELLOW, WALK, DONT_WALK...
7U. Write Verilog code that implements the 3-way T-intersection with each side having red, yellow and green lights. Assume that car on the right has priority and only one side has green light at any given time and yellow light is on for 2 to 4 seconds. Solution: 7U. Write Verilog code that implements the 3-way T-intersection with each side having red, yellow and green lights. Assume that car on the right has priority and only one side has green...
Python problem: 1. The colors red, blue, and yellow are known as the primary colors because they cannot be made by mixing other colors. When you mix two primary colors, you get a secondary color, as shown here: When you mix red and blue, you get purple. When you mix red and yellow, you get orange. When you mix blue and yellow, you get green. Create a text file with the names of two colors in it. Write a program...
Question 18 What is output to the display when the following executes? enum myColor {BLUE, RED, GREEN, YELLON); myColor car = static_cast myColor>( 1 ); dost ahan cout << "My car is " << car <<endl; athellahaninskih none of these My car is RED My car is BLUE My car is 1 D Question 19 Is the following code fragment valid or invalid enum myColor blue, red, green, yellow): invalid valid Question 20 What happens if an ifstream successfully opens...
Problem 4 For this question, you will write a program called drive.py that determines if a car should go through an intersection or stop. Your program will prompt the user for the colour of the traffic light at the intersection (a string), the distance to the intersection in meters (a float), and the speed of the car in meters per second (a float). Your program must then determine if the car should go through the intersection or stop. The following...
I need java code for the following problem. Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that accepts one integer parameter and returns the value raised to the third power as an integer. o Write a method called randominRange that accepts two integer parameters representing a range. The method returns a random integer in the specified range inclusive. 2. o Write a method...
3. In the main function, pthread create is called to create four child threads. A data file is divided into four blocks. Each child thread handles one block hild . After all four child threads complete, the main thread print out a final result. Write pseudocode to solve the above program. In your code, OVERLOOK the detail of opening a file, divide a file or handle a block. For example, use the comment //open a file to indicate the action...
create a new Java application called "CheckString" (without the quotation marks) according to the following guidelines. ** Each method below, including main, should handle (catch) any Exceptions that are thrown. ** ** If an Exception is thrown and caught, print the Exception's message to the command line. ** Write a complete Java method called checkWord that takes a String parameter called word, returns nothing, and is declared to throw an Exception of type Exception. In the method, check if the...
public static double[] getVolumes(double[] base, double[] height, double[] length) Write a Java program called TriangularPrisms which does the following: In the main method: Use a for loop which repeats three times. Within the loop, a. prompt the user to enter the base of the triangular prism and store the value in a double array called base b. prompt the user to enter the corresponding height and store the value in a double array called height c. prompt the user to...
Write a program that demonstrates use of programmer - defined data structures. Please provide code! Thank you. Here are the temps given: January 47 36 February 51 37 March 57 39 April 62 43 May 69 48 June 73 52 July 81 56 August 83 57 September 81 52 October 64 46 November 52 41 December 45 35 Janual line Iranin Note: This program is similar to another recently assigned program, except that it uses struct and an array of...
python program please Write a function called backwards which takes two parameters. The first is a file object that has already been opened in read mode called essayfile. The second is called filename, which contains the filename for the output file that will need to be properly opened and closed in your function. The function should read from already opened file object line by line. Each line in the file should have the words on the line reversed. For example,...