Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

1. TicketsRUs needs an application to calculate ticket prices. There are three ticket prices:

• Orchestra $85 each
• Mezzanine $70 each
• Balcony $45 each

There is also a 15% discount on matinee performances.

Your application has the GUI shown below.

With the following named components:

Component

Type

Purpose

txtNum

JTextField

Input for number of tickets

chkMatinee

JCheckBox

Check if matinee performance

radOrchestra

JRadioButton

Check for orchestra tickets

radMezzanine

JRadioButton

Check for mezzanine tickets

radBalcony

JRadioButton

Check for balcony tickets

btnCalc

JButton

Click to calculate price

txtEach

JTextField

Displays price of each ticket

txtTotal

JTextField

Displays total price

Clicking the CalcPrice button should determine the price per ticket and the total price based on the user's input and display in txtEach and txtTotal. You should make sure the number of tickets is entered and a ticket type is selected, otherwise give an error message.

The action listener for btnCalc is set up as follows.

btnCalc.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
calcPrice(); //write the code for this method
}
});

Write the calcPrice method that is called by the action listener. This class method has access to all of the GUI components. You DO NOT HAVE TO CODE THE GUI. ONLY write the code for this method which does all the work. The header for the method is:

private void calcPrice()

2. Employees at a certain company get a yearly bonus based on years of service. The bonus is a percentage of their annual salary based on the table below.

Years of Service

Bonus Percentage

< 5

3%

5 - 14

7%

15++

12%

Create a class called Employee that can be used for this.

It should have attributes of

• Name;
• Years; and
• Salary.

Create the following methods.

• Default constructor to initialize all attributes
• Get/Set for name, years, salary
• Get to calculate and return bonus rate
• Get to calculate and return bonus amount

This class will be used with the Bonus Calculator GUI shown below.

With the following named components:

Component

Type

Purpose

txtName

JTextField

Input for name

txtYears

JTextField

Input for years

txtSalary

JTextField

Input for salary

btnCalc

JButton

Click to calculate bonus

txtBonusPercent

JTextField

Displays bonus percentage

txtBonusAmount

JTextField

Displays bonus amount

You DO NOT have to code the GUI.

The action listener for btnCalc is set up as follows.

btnCalc.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
calcBonus(); //write the code for this method
}
});

3. A trucking company has an application to track data from their trucks regarding miles driven and fuel used each month. This information is stored in a file named "trucks.txt" . This table has the following fields.

TruckID

Truck Number (String)

Miles

Miles Driven (double)

Fuel

Fuel Used (double)

Format of file - note the # delimiter character between fields

TruckID#miles#fuel

The application has a button that is clicked to read each line of the file and calculates and displays in the console the total miles driven, total fuel used, and average miles per gallon. You DO NOT have to write a separate class to process the data. The output in the console should look like:

Total miles driven by all trucks xxx

Total gallons of fuel used yyy

Average miles per gallon for the fleet zz.zz

The class method readFile() is called by the action listener to do the work. Write the code for this method.

4. Assume a College database has a table to keep transcript data on students. The transcript table has fields for SSN, TotalPoints, and TotalCredits. You are to design an application that allows a student to input their SSN into a textbox (txtSSN) and press a button (btnCalc). The students GPA is calculated (divide points by credits) and displayed in txtGPA.

Describe the process/steps to do this. Write pseudocode/comments or code where you can. You DO NOT have to have complete working code, you need to describe the necessary steps and WHERE things need to be coded.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92067332
  • Price:- $50

Priced at Now at $50, Verified Solution

Have any Question?


Related Questions in Computer Engineering

A confidence interval for a population mean is to be

A confidence interval for a population mean is to be estimated. The population standard deviation is guessed to be anywhere from 14 to 24. The half-width B desired could be anywhere from 2 to 7. Tabulate the minimum samp ...

1 the economy is in a recession with high unemployment and

1) The economy is in a recession with high unemployment and low output (i.e. the output currently is lower than the natural level of output) a) Draw a graph of aggregate demand and aggregate supply to illustrate the curr ...

Youre trying to save to buy a new 190000 bmw 3 series

You're trying to save to buy a new $190,000 BMW 3 series sedan. You have $40,000 today that can be invested t your bank. The bank pays 4.8% annual interest on its accounts.  How long will it be before you have enough to ...

You are required to carry out an analysis of the it

You are required to carry out an analysis of the IT requirements of a software company and design a virtualisation solution to satisfy these requirements. You will need to produce a report outlining your design and provi ...

From slide number 1-37 how did we get value 00004 show all

From slide number 1-37, how did we get value 0.0004? Show all your work. Describe the most popular wireless Internet access technologies today. Compare and contrast them. What is the key distinguishing difference between ...

Assignment - dijkstra algorithmdijkstras algorithm finds

Assignment - Dijkstra Algorithm Dijkstra's algorithm finds the shortest path from a given node to all other nodes. 1) We observe that we can modify this algorithm to stop as soon as a particular node is reached; thus pro ...

Analyze the time complexity of the following ternary search

Analyze the time complexity of the following ternary search algorithm: identify two points that subdivide a sorted array into three parts. If the given number is equal to one of these two points, we are done. Otherwise, ...

You run a small pizza shop named pizza hat initially you

You run a small pizza shop named Pizza Hat. Initially you sold pizzas for $8 and every week you sold around 3000 pizzas. Each pizza costs you $3 to make. One day you decided to o¤er discounts to customers to see if you c ...

Question suppose that a simple fpga programmable switch

Question : Suppose that a simple FPGA programmable switch that has four destination points (N, S, E and W) and consists of 6 pass transistors with 6-SRAM cells to program each gate (T1, T2, T3, T4, T5, T6) is used. If th ...

Question suppose f is a function that returns the result of

Question : Suppose f is a function that returns the result of reversing the string of symbols given as its input, and g is a function that returns the concatenation of the two strings given as its input. If x is the stri ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As