Determine the price per ticket and the total price

Assignment Help Computer Engineering
Reference no: EM131312711

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.

Reference no: EM131312711

Questions Cloud

Evaluate the run time of the isvalidsource() function : Would it buy us anything to use a tail reference with the linked list structure used to implement the Stack ADT? Explain your answer.
Build balanced scorecard for the unit of the organization : Build a Balanced Scorecard for the unit of the organization for which you work, or have worked. Unless you are in senior management, focus on the unit with which you are most familiar rather than the organization as a whole. Identify the strategic ob..
How much elongation do we want to create : We want to tighten an ASTM A193 bolt having 4-8 UN threads and a yield strength of 96 ksi.- How much elongation do we want to create if the target tension is 80 ksi?
Understand consumer behavior rather than consumer behavior : Why is it important that marketers understand consumer’s behavior rather than consumer behavior? What are 2 ways companies make purchase decisions versus the way individuals make purchase decisions?
Determine the price per ticket and the 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.
Maintain existing targets and raise the target : The operative question among macro policy specialists and investors is “when will the Federal Reserve target higher interest rates in 2016?” December of 2016 marks the last meeting month of the year for the Federal Open Market Committee to select one..
Implementation of the stack adt using the python list : Consider our implementation of the Stack ADT using the Python list, and suppose we had used the front of the list as the top of the stack and the end of the list as the base. What impact, if any, would this have on the run time of the various stac..
How much change in length of the bolt would you expect : The bolt of problem is put in service and its temperature rises to 2508F. How much change in length of the bolt would you expect this increase in temperature to create?
Prepare actionable professional development plan : You will be assessed on the appropriateness and completeness of the detail you provide regarding your topic, your use of citations and references as noted above, and your intellectual insight into topically important issues.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Compute a sequence of approximations of e

E19: Numerical Methods for Engineering Applications Spring 2016 - HOMEWORK 1. Compute a sequence of approximations of e (using x = 1) until the approximate relative error εa is small enough to guarantee at least four significant digits of precision

  Discuss aspects of hearing that are important in ergonomics

Discuss those aspects of hearing that are important in ergonomics; include the issues of normal background sounds, emergency notices, masking, and Signal Detection Theory.

  Mapping the cache organization

A computer has a memory of 16 blocks, 32 bytes each, and a cache of 8 blocks, which blocks may be read from the block No. 5 in the cache, if the system utilizes: Fully associative the mapping cache organization.

  Calculating the overall class average

It is now the end of the semester and Alberta would like to have a program which inputs each student`s test scores and outputs average score for every students and the overall class average.

  In this exercise you are required to write a computer

in this exercise you are required to write a computer program which will calculate the voltage across a resistor in the

  What are the advantages and disadvantages of approach

consider whether or not the same people who develop the software should be tasked with maintaining it or whether or not a separate group must be tasked with development of software and separate group with maintaining it.

  Evaluate the process using informal benchmarking

Describe in very general terms the as-is business process for applying for admission at your university. Collaborate with another student in your class and evaluate the process using informal benchmarking.

  Design a few changes for new features

The existing software has a number of bugs filed against it. How would you go about debugging the existing software to find out the causes of these problems and testing your fixes to see if they really fix the problems?

  Create a cost-benefit analysis that illustrates the return

Suppose that you are interested in buying yourself a new computer. Create a cost-benefit analysis that illustrates the return on investment that you would receive from making this purchase.

  Develop guidelines for professional responsibilities

Continuing with the scenario from Week 5, develop guidelines for professional responsibilities in an organization related to identifying and resolving ethical issues in IT.

  There is a common misconception that analog technology is

there is a common misconception that analog technology is no longer used in the transmission of digital data. however

  Write down a function called numweeks

Write down a function called numWeeks that takes an integer parameter representing a number of days and returns an integer that is the number of whole weeks in that number of days.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd