Question

In: Computer Science

In this project, you will create a Visual Basic solution to perform customer billing at the...

In this project, you will create a Visual Basic solution to perform customer billing at the Cyberian Internet Cafe. Please see below for the detailed instructions. You will create the project and then design a form using the image provided here. Then, add the necessary code to do the billing calculation and display the amount due.

Instructions

In this case, you will create a Visual Basic solution that performs customer billing for the Cyberian Internet Café. The Cyberian Internet Café provides Internet access to its customers on an hourly basis. One hour of Internet access costs $12.00. You will create a solution with a splash screen, which is an application that calculates the total cost for a customer, using the image file included in the downloaded files.

Step 1: Create the Project:

Create a Visual Basic Project using the project name “InternetCafe”.

Step 2 – Design the Form:

Design the form shown in Figure 1. You will need three button controls, three text boxes, one picture box control, and five label controls. Name your controls as shown in Table 1, and set the properties as indicated.

Type of Control

Property

Property value

Form

Name

MainForm

Text

Customer Billing

StartPosition

CenterScreen

Label

Name

Label1

Text

Cyberian Internet Café

Font.Size

20

Button

Name

calculateButton

Text

Calculate

Button

Name

clearButton

Text

Clear

Button

Name

exitButton

Text

Exit

Label

Name

Label2

Text

Last Name

Label

Name

Label3

Text

First Name

Label

Name

Label4

Text

Number of hours

Label

Name

Label5

Text

Amount due

Label

Name

amountDueLabel

BorderStyle

FixedSingle

BackColor

White (web color)

PictureBox

Name

PictureBox1

Size.Width

174

Size.Height

174

BorderStyle

FixedSingle

Image

(use the downloaded image file

TextBox

Name

lastNameTextBox

TextBox

Name

firstNameTextBox

TextBox

Name

hoursTextBox

Table 1 – MainForm Controls and Their Property Values

Step 3 – Add the image to the project’s Debug folder:

Copy the image files (J0195384.jpg) that you downloaded as part of this Case’s files into the following folder of your project:

C:\InternetCafe\ InternetCafe\bin\Debug

(If your drive letter is different than C:, use your drive letter.)

Step 4 – Add code to perform the calculation and display the amount due:

  1. In the form’s Declarations section, declare a constant named HOURLY_RATE and set its value to be 12.00.
  2. In the clearButton’s Click event, add code to clear all of the text box controls and the amountDueLabel control.
  3. In the calculateButton’s Click event, declare two Single variables named hours and amount, and a Boolean variable name isConverted. Use the TryParse method to assign the value in the hoursTextBox control to the hours variable, storing the result from the TryParse method in the isConverted variable. Do the calculation using the hours and the hourly rate, and store the result in the amount variable. Display the amount value, formatted as currency, in the amountDueLabel control.
  4. In the exitButton’s Click event, add code to end the program.

Step 5 – Create a splash screen

Create a splash screen using the Project menu - Add Windows Form. Select the Splash Screen form template.

Also change the splash window title to "Internet Cafe". reference : textbook page 114.

Set project properties:

Set the project’s startup form to be MainForm.   Set the project’s splash screen to be SplashScreen.

Step 6: Save and run

Save all files, then start the application. Try entering data and using the Calculate button. Is the result formatted as currency?

Solutions

Expert Solution

Creating Main Form:

  • Open a new visual basic project project and select Windows Forms Application and give the application name as 'InternetCafe'. Then a form1 will be appeared.
  • Select the form and change the name property as 'MainForm' , text property as 'Cusomer Billing' and start position as 'centerScreen'
  • Drag a label(label1) on to main form change the text property as Cyberian Internet Cafe and Font.Size as 20
  • Drag three labels(label2,label3 and label4) on to main form change the text property as Last Name,First Name, Number of hours respectively.
  • Drag three text boxes on to main form and change the text property as lastNameTextBox,firstNameTextBox, hoursTextBox respectively. place these three text boxes parallel to three text labels.
  • Drag a label(label5) on the main form and change the text property as Amount due.
  • Drag another label(label6) and change the name property as amountDueLabel, border style as FixedSingle, BackColor White(web color)
  • Drag a picture box onto main form and change size.width as 174 and size height as 174, border style fixed single and image(click on image property and import the image file J0195384.jpg)
  • Drag three buttons onto main form and change the name property as calculateButton,clearButton and exitButton respectively. Also change their text properties as Calculate, Clear and Exit
  • In the MainForm class , declare a constant variable as follows:

Const HOURLY_RATE = 12.0

  • Double Click on calculate button and add the following code:

Dim hours As Double
Dim amount As Double
Dim isConverted As Boolean
isConverted = Double.TryParse(hoursTextBox.Text, hours)
If isConverted Then
amount = hours * HOURLY_RATE
End If
amountDueLabel.Text = Format(amount, "Currency")
Double click on clear button and add the following code:
lastNameTextBox.Text = ""
firstNameTextBox.Text = ""
hoursTextBox.Text = ""
amountDueLabel.Text = ""
Double click on the Exit button and add the following code:
Me.Close()

Creating Splash screen:

  • select splash screen and change the text property as 'InternetCafe'
  • right click on the project in the solution , then click on add, and then windows Forms (or new item).
  • then select the splash screen template and give the name as 'SplashScreen'
  • click Add
  • now select the Application title in the splash screen and change the name property as 'InternetCafe'

Setting project's setup:

  • Right click on project in the solution explorer and click on properties.
  • select the MainForm as the startup Form and Splash screen as the splash screen

  • if you want to set more time for splash screen, click on view application events,
  • then Namespace My will be appeared
  • in My Application class Add the following function to set the splash screen time

Protected Overrides Function OnInitialize(commandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String)) As Boolean

Me.MinimumSplashScreenDisplayTime = 3000
Return MyBase.OnInitialize(commandLineArgs)
End Function
Sample output:

Code to copy :

Form1.vb:
Public Class MainForm
Const HOURLY_RATE = 12.0
Private Sub calculateButton_Click(sender As Object, e As EventArgs) Handles calculateButton.Click
Dim hours As Double
Dim amount As Double
Dim isConverted As Boolean
isConverted = Double.TryParse(hoursTextBox.Text, hours)
If isConverted Then
amount = hours * HOURLY_RATE
End If
amountDueLabel.Text = Format(amount, "Currency")
End Sub
Private Sub clearButton_Click(sender As Object, e As EventArgs) Handles clearButton.Click
lastNameTextBox.Text = ""
firstNameTextBox.Text = ""
hoursTextBox.Text = ""
amountDueLabel.Text = ""
End Sub
Private Sub exitButton_Click(sender As Object, e As EventArgs) Handles exitButton.Click
Me.Close()
End Sub
End Class


Related Solutions

Create programs in Visual Basic which perform each of the following: Explain the different design choices...
Create programs in Visual Basic which perform each of the following: Explain the different design choices (syntax) for option in each language Document the programs using Flowcharts Each programs source code must be included – label each with the language used a) Nested two-way selection statements b) Multiple-way selection statement c) Iterative Statements – Counter controlled and Logic controlled d) After the Counter Controlled Iterative successfully completes – Display “This was a success” on the screen.
Create programs in Visual Basic which perform each of the following: Explain the different design choices...
Create programs in Visual Basic which perform each of the following: Explain the different design choices (syntax) for option in each language Document the programs using Flowcharts Each programs source code must be included – label each with the language used a) Nested two-way selection statements b) Multiple-way selection statement c) Iterative Statements – Counter controlled and Logic controlled d) After the Counter Controlled Iterative successfully completes – Display “This was a success” on the screen.
create a Visual Basic project with the following features: 1. The user interface can display the...
create a Visual Basic project with the following features: 1. The user interface can display the following information, one textbox for one item: 1a. Author, in the form of Lastname, Firstname 1b. Title 1c. Source -- where the paper is published 1d. Abstract 1e. Publication year (This information is in the 1c. Source, but display the publication year separately here) 2. There is a command button "Import". It would allow the user to select the eric.txt as the input file...
Use Visual Basic Language In this assignment you will need to create a program that will...
Use Visual Basic Language In this assignment you will need to create a program that will have both a “for statement” and an “if statement”. Your program will read 2 numbers from the input screen and it will determine which is the larger of the 2 numbers. It will do this 10 times. It will also keep track of both the largest and smallest numbers throughout the entire 10 times through the loop. An example of the program would be...
USE VISUAL BASIC / VB You will create a datafile with the following information: 70 80...
USE VISUAL BASIC / VB You will create a datafile with the following information: 70 80 90 55 25 62 45 34 76 105You will then write the program to read in the values from the datafile and as you read in each number, you will then evaluate it through an if statement for the weather of the day. For example, when you read in the value 70 from the datafile, you should print to the screen that the temperature...
Create a view named customer_addresses that shows the shipping and billing addresses for each customer. This...
Create a view named customer_addresses that shows the shipping and billing addresses for each customer. This view should return these columns from the Customers table: customer_id, email_address, last_name and first_name. This view should return these columns from the Addresses table: bill_line1, bill_line2, bill_city, bill_state, bill_zip, ship_line1, ship_line2, ship_city, ship_state, and ship_zip. I have this CREATE VIEW customer_addresses AS SELECT customer_id, email_address, last_name, first_name, bill_line1, bill_line2, bill_city, bill_state, bill_zip, ship_line1, ship_line2, ship_city, ship_state, ship_zip FROM Customers, Addresses WHERE Customers.customer_id = Addresses.customer_id...
Create a C++ project in visual studio. You can use the C++ project that I uploaded...
Create a C++ project in visual studio. You can use the C++ project that I uploaded to complete this project. 1. Write a function that will accept two integer matrices A and B by reference parameters, and two integers i and j as a value parameter. The function will return an integer m, which is the (i,j)-th coefficient of matrix denoted by A*B (multiplication of A and B). For example, if M = A*B, the function will return m, which...
Use Visual Basic Language In this assignment,you will create the following data file in Notepad: 25...
Use Visual Basic Language In this assignment,you will create the following data file in Notepad: 25 5 1 7 10 21 34 67 29 30 You will call it assignment4.dat and save it in c:\data\lastname\assignment4\. Where lastname is your last name. The assignment will be a console application that will prompt the user for a number. Ex. Console.Write(“Enter a number: ”) And then read in the number Ex. Number = Console.ReadLine() You will then read the data file using a...
Description: To create a Visual Basic program that will obtain a sentence from the user, parse...
Description: To create a Visual Basic program that will obtain a sentence from the user, parse the sentence, and then display a sorted list of the words in the sentence with duplicate words removed. Tasks: Design a method (algorithm) to solve the above problem using pseudocode or a flowchart. Translate your algorithm into an appropriate VB program and test it using the following input sentence. "We are the world We are the children" Submit: Pseudocode version of algorithm/Flowchart version of...
Program on Visual Basic, VBA Create an application that lets the user enter a number of...
Program on Visual Basic, VBA Create an application that lets the user enter a number of seconds and produces output according to the following criteria: There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes in that many seconds. There are 3,600 seconds in an hour. If the number of seconds entered by the user is greater than or...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT