Write a java program that would simulate traffic lights


Assessment: Database and Multithread Programming

Task

Task 1: Grade Processing

University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate student marks. ‘Java2' is one of the tables which contains following information/attributes for all the students enrolled in "Java2":

A sample of the table may look like as follows:

ID

StudentName

Quiz

A1

A2

A3

Exam

Results

Grade

11111111

X

100

85

100

90

90

91.75

HD

22222222

Y

100

60

80

80

75

75.5

DI

Write a JAVA Graphical User Interface (GUI) program that would perform following tasks:

- Create Table: Create a table that is capable to store above information.
- Insert Record: If the user of your program wants to insert a record, your program should ask for all the fields of the record and insert them in the table.
- Search: The user of your program should be able to search a particular record by ID or any other field.
- Update: The user of your program should be able to update any field/s of a particular record. The record in which the update operation needs to be done will be selected by ID.
- Calculate Results: The results of a student should be calculated using the following formula: Results = (Quiz * 0.05)+(A1* 0.15) +(A2* 0.2) + (A3* 0.10) + (Exam * 0.5)
- Calculate Grade:
HD: Results>=85
DI: 75<=Results<85
CR: 65<=Results<75
PS: 50<=Results<65
FL: Results<50
Note that ID must be 8-digit number, A1, A2, A3 and Exam Marks must be between 0 and 100 (inclusive), and Results must be floating-point numbers with two decimal places.

Task 2: Traffic light simulation

Write a JAVA program that would simulate traffic lights using the concept of Multithreading. One example is shown in the following figure. Each light has two statuses, "on" amd "off". Moreover, the time of each light switching status can be set using the text input box beforehand. If the user clicks on the "Start" button, the program starts to work. While if the "End" button is clicked, the program stops working but not terminates. The program terminates only when the "X" button on right-upper corner. Please note that, initially the switching time for each light would be set to "3". As shown in the last column of following fiure, you should also display the text indicating the status of traffic light.

Attachment:- Assessment.rar

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Write a java program that would simulate traffic lights
Reference No:- TGS02925156

Expected delivery within 24 Hours