PassTask3

PassTask3 1

In this section, you will create a new Console Project which contains a Transaction class
and a TransactionMode enumeration.
Each Transaction will:
■ Know its transaction number
■ Know its date
■ Know its amounts
■ Know its points gained
■ Know what transaction mode it belongs
■ Can be constructed with a given transaction number, date, amounts, and transaction
mode
■ Can update the points based on the transaction amount (For every transaction amount
of RM10 is equivalent to 1 point)
■ Can be printed, which returns a message depending on the transaction mode.
These are the following Transaction Mode, and they return the indicated messages:
■ Online
o “That’s a wise choice with more rewards”
■ Offline
o “You have secured some points”

GuessNumberGame C#

GuessNumberGame C# 2

Make sure to complete the Setup Confirmation assignment. It will walk you through how to prepare a Visual Studio project.
Rules: Create a program that explains the rules of the game.
Player 1 Picks a number between 0 and 100
Player 2 gets 5 guesses to find Player 1’s number.
After Player 2 guesses correctly or loses the game, the game will provide the option to start over.
At any time, the users can opt to exit out of the game by typing “quit” or “exit”
Player 1: User will input a number between 0 and 100.
The program should validate that:
Player 1 did input a number and not anything else
If the number is ***** than 0, make it 0.
If the number is ***** than 100, make it 100.
If Player 1 did not input a number, ask the player to please stick to only numbers.
The program will then ask Player 2 for their guess.
Player 2: User will input a number between 0 and 100
The program should validate this input the exact same way using the same criteria
Assessment:
If the guess is correct, the game will tell the player how many guesses it took to get it right.
If this is the last guess, the game will tell the player that they have run out of guesses and have lost the game.
If the guess is too high or too low, the game will relay that information to the player and also provide how many guesses are left.

Write a program named HoursAndMinutes

Write a program named HoursAndMinutes 3

Write a program named HoursAndMinutes that declares a minutes variable to represent minutes worked on a job, and assign a value to it.Display the value in hours and minutes. For example, if 98 is assigned to the minutes variable, the output would be: 98 minutes is 1 hours and 38 minutes.Note: For final submission assign 197 to the minutes variable

Discount

Discount

You have been contracted to create an application that can be used to determine the discount awarded for preferred customers. Because of the time limitation, you should focus your attention on the preferred customer class. Include data members of customer ID, customer name, and customer purchase. Define appropriate constructors and properties for the class.
Include a method that returns the discount percentage based on the following:
• When a preferred customer spends a minimum of $500, he or she gets a 5 percent discount
• When a preferred customer spends a minimum of $1,000, his discount is 6 percent
• When a preferred customer spends a minimum of $1,500, his discount is 7 percent discount
• When a preferred customer spends at least $2,000, he or she gets a 10 percent discount
Include an additional instance method that returns the actual reduced discounted price. Override the ToString( ) method to return the customer name, his purchase amount (formatted as currency), discount percentage (if any),and the reduced purchase price (formatted as currency).
Define the 2nd class to test your preferred customer class. You may instantiate your objects with literal data sent as arguments to the constructors. You do not have to input the data. USE YOUR OWN NAME AS THE CUSTOMER NAME FOR ONE OF THE OBJECTS THAT YOU INSTANTIATE. Before instantiating an object of the class, check to make sure the purchase amount entered is a positive integer. If the value entered for the purchase amount is negative, display an error message indicating the input is in-valid. Modularize your solution.
Sample output might look like:
Test1:
Customer: Barbara Doyle
Purchase Amt. $1,423.78
Discount Percent: 6%
Discounted Amt.: $1,338.36
Test2:
Customer: Sarah Wang
Purchase Amt. $401.28
Discount Percent: 0%
Discounted Amt.: $401.28

Dice

Screenshot 1-15

Create an application that simulates rolling a pair of dice. When the user clicks a button, the application should generate two random numbers, each in the range of 1 through 6 inclusive, to represent the value of the dice. Use PictureBox controls to display the dice. Use the dice images provided in the module or find your own dice images to use.

UnitConverter

Screenshot 1-5

In the English measurement system, 1 yard equals 3 feet and 1 foot equals 12 inches. Use this information to create an application that lets the user convert distances to and from inches, feet, and yards. The user should enter the distance to be converted into a TextBox. A ListBox should be used to allow the user to select the units being converted from, and another ListBox should be used to allow the user to select the units being converted to.Be sure to handle the situation where the user picks the same units from both list boxes. The converted value will be the same as the value entered.A sample application form can be found in the text on page 265.

PaintPriceCalculator

Screenshot 1-10

A painting company has determined that for every 115 square feet of wall space, one gallon of paint and eight hours of labor will be required. The company charges $20.00 per hour for labor.

Write a program that asks the user to enter the square feet of wall space to be painted and the price of the paint per gallon. The program should display the following data:

The number of gallons of paint required
The hours of labor required
The cost of the paint
The labor charges
The total cost of the paint job

TicketsRUs

TicketsRUs 4

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

• Orchestra $90 each
• Mezzanine $75 each
• Balcony $50 each

There is also a 20% 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()

HeadTailShow

HeadTailShow 5

Your client needs an application to that can display either the heads or tails of a coin. You need to create an application with a Show Heads button and a Show Tails button. When the user clicks the Show Heads button, an image of the heads side of a coin should appear. When the user clicks the Show Tails button, an image of the tails side of a coin should appear. The following figure shows how the application’s form should appear after either the Show Heads button or Show Tails buttons have been clicked.
Think carefully about your implementation. In particular how the form will look when the application firsts starts. Should any coins be showing?. For this question a GUI has been provided by the client. Make sure you implementation matches the clients requestThe client has supplied the images to be used. To achieve full marks, your solution must:Meets the client requirements specified above;
Work correctly;
Contain appropriate comments;
Use appropriate indentation; and
Follow conventions for naming variables and controls

Parking Charges

Parking Charges 6

Parking Charges

A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time.

Write an app that calculates and displays the parking charges for each customer who parked in the garage yesterday. You should enter the hours parked for each customer. The app should display the charge for the current customer and should calculate and display the running total of yesterday’s receipts. The app should use method CalculateCharges to determine the charge for each customer.

×
New Download