
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Information about the first homework assignment for the data structures i course offered by wentworth institute of technology in the spring of 2007. The assignment involves using an enum, enhanced for loop, and switch statement to sequence through trafficlight values and output their colors and associated messages from a file. The messages are stored in a tab-delimited text file called traffictext.txt.
Typology: Assignments
1 / 1
This page cannot be seen from the preview
Don't miss anything!
COMP380 Section 71 - Data Structures I - Spring, 2007
Instructor: Bob Goldstein (617) 912- bobg@vision.eri.harvard.edu http://webpages.charter.net/tlgcreations/Courses/index.html http://goldstein.eri.harvard.edu/courses/index.html http://myweb.wit.edu/goldsteinr/Courses/index.html Due Date: January 23, 2007 Hand In: Printout of program code and dialogue of how it runs. Purpose: This homework is intended to use the enum facility, enhanced for statement and the Scanner class. Description: This program is based on problem 1.10 of Ford and Topp Declare the enum
Using an enhanced for loop and a switch statement, sequence through the TrafficLight values and output the color of the light along with a message associated with each color. The messages are as follows: green – “SafeToGo” yellow – “ExerciseCaution” red = “StopImmediately” The messages should NOT be hardcoded into the program. The messages should be read from a file that you create. Make the file with the messages using a text editor (Notepad is ok), called trafficText.txt and read in the messages using the Scanner class. Here are the contents and format of the tab-delimited file: green SafeToGo yellew ExerciseCaution red StopImmediately Here is an output of the program. The program requires no user input: 3 color messages read into the program The values of the traffic lights and their meanings are: green SafeToGo yellow ExerciseCaution red StopImmediately /app/work/qkd80q-459235-2765026-homework1-doc.doc 1 12/5/2020 12/5/