0% found this document useful (0 votes)
49 views

Graded Exercise #4 Array and Mainmenu Control Form 1: Password Entry

The document provides code for a multi-form C# application that allows users to enter login credentials, select transactions, and view billing details. Form1 handles password authentication and passes control to Form2 upon valid login. Form2 displays menu options to select transactions or view about details. The transaction option opens Form3, which enables adding item details and payment processing. Viewing about opens Form4 to show author information. Form3 code handles adding items, calculating totals, and payment processing. Form4 code displays author details. Additional code in Form1 calculates billing amounts based on check-in/out dates selected. Validation ensures required fields are populated before processing transactions.

Uploaded by

Jhay El Gamba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views

Graded Exercise #4 Array and Mainmenu Control Form 1: Password Entry

The document provides code for a multi-form C# application that allows users to enter login credentials, select transactions, and view billing details. Form1 handles password authentication and passes control to Form2 upon valid login. Form2 displays menu options to select transactions or view about details. The transaction option opens Form3, which enables adding item details and payment processing. Viewing about opens Form4 to show author information. Form3 code handles adding items, calculating totals, and payment processing. Form4 code displays author details. Additional code in Form1 calculates billing amounts based on check-in/out dates selected. Validation ensures required fields are populated before processing transactions.

Uploaded by

Jhay El Gamba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

GRADED EXERCISE #4

Array and MainMenu Control


FORM 1: Password Entry

Note: No limit for password, if incorrect password will prompt the user to RETRY & CANCEL and
username should have an entered value otherwise will prompt the user to enter value for
username.

If the password is correct will display the 2nd form (MENU).


FORM 2: (with File & Help Menu)
Main Menu: File Help
Sub Menus: Transaction About
Exit
<File><Transaction>
 Will display the Transaction Form (Form 3)

For TRANSACTION Form:


Initially; BUTTONS: New, Clear, Close & Compute are all in disabled layout (as shown
below)

<File><Exit>
 Will close the program

FORM 3
Logical Problems:
 Double click Appliance item (List Box) then the selected item will be displayed to the
Appliance Sold (List Box) and Unit Price (List Box) (see example below)
Note: Be sure that you have enter value in the Quantity

 If quantity is less than or equal to zero (0) it will prompt the user to input quantity.

 Amount: Text Box will be based on the Appliance: Unit Price * Quantity
Example: Appliance sold: Electric Fan, Unit Price: 500, Quantity: 2 (see example below)
 Sub-total Text Box will be based on the total item sold.
Example: Appliance Sold: Air Conditioner: 10,000.00 x 1 and Electric Fan: 500 x 2 (see
example below)
 Choose Type of Payment: cash or Charge then, will enable Compute button
If Compute button is clicked; for CASH
Total Amount = Sub-total less 5% discount

 Then, will enable buttons; New, Clear & Close


 Enter value for Amount Tendered.
Amount Tendered should be exact amount or should be greater than Total Amount
otherwise, will prompt the user to enter valid amount.
 Click Change button to display the amount change.
 For New button, will clear all entries
 For Clear button, will clear Quantity, Appliance Sold, unit Price and Type of Payment
only.
 If Compute button is clicked; for CHRAGE
Total Amount = Sub-total + 5% additional charge
 For Close button, will close the transaction window only.
FORM 4:

 If help then About is clicked will display a Form “About the program”
 If button OK is clicked will close the form window.

 If button AUTHOR is clicked will display programmer name


FORM #4: Hotel Billing System

Problem:
 Compute for Total Amount based on the date of check-in and checkout.

 Select room capacity, room type and payment type before clicking Compute button
otherwise, will prompt you with “No selected room capacity” or “No selected room
type” or “No selected type of payment”
 Note: If the customer checked-in and checked-out on the same day will charge him/her
of 1 day.
FORM 1 CODES:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Honrada
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)


{

private void btnAccept_Click(object sender, EventArgs e)


{
if (txtUser.Text=="admin" && txtPass.Text=="admin")
{
Form2 frm2 = new Form2();
this.Hide();
frm2.Show();
}
else if (txtUser.Text !="admin")
{
MessageBox.Show("Enter Value for User Name");
}
else if (txtPass.Text !="admin")
{
MessageBox.Show("RETRY & CANCEL");
}
}

private void btnCancel_Click(object sender, EventArgs e)


{
Application.Exit();
}
}
}
FORM 2 CODES:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Honrada
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}

private void exitToolStripMenuItem_Click(object sender, EventArgs e)


{
Application.Exit();
}

private void aboutToolStripMenuItem_Click(object sender, EventArgs e)


{
Form4 frm4 = new Form4();
this.Hide();
frm4.Show();
}

private void transactionToolStripMenuItem_Click(object sender, EventArgs e)


{
Form3 frm3 = new Form3();
this.Hide();
frm3.Show();
}
}
}
FORM 3 CODES:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Honrada
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
button2.Enabled = false;
button4.Enabled = false;
button5.Enabled = false;
button7.Enabled = false;
}

private void Form3_Load(object sender, EventArgs e)


{

private void listBox2_SelectedIndexChanged(object sender, EventArgs e)


{
listBox1.Text = listBox1.Text + "Air Conditioner";
}

private void panel6_Paint(object sender, PaintEventArgs e)


{

private void panel2_Paint(object sender, PaintEventArgs e)


{

private void textBox4_TextChanged(object sender, EventArgs e)


{

private void textBox5_TextChanged(object sender, EventArgs e)


{

private void panel7_Paint(object sender, PaintEventArgs e)


{

private void label11_Click(object sender, EventArgs e)


{

private void button1_Click(object sender, EventArgs e)


{
}

private void button5_Click(object sender, EventArgs e)


{
Form2 frm2 = new Form2();
this.Hide();
frm2.Show();
}

private void button3_Click(object sender, EventArgs e)


{
}

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)


{
button2.Enabled = true;
button4.Enabled = true;
button5.Enabled = true;
button7.Enabled = true;

private void button2_Click(object sender, EventArgs e)


{
MessageBox.Show("Input Quantity");
}

private void textBox3_TextChanged(object sender, EventArgs e)


{

}
}
}
FORM 4 CODES:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Honrada
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
}

private void btnOK_Click(object sender, EventArgs e)


{
Form2 frm2 = new Form2();
this.Hide();
frm2.Show();
}

private void btnAuthor_Click(object sender, EventArgs e)


{
MessageBox.Show("Programmer:\nRichard C. Trabalo", "Author",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
FORM 4 Hotel Billing System

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Number2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void lblDateTime_Click(object sender, EventArgs e)


{

private void Form1_Load(object sender, EventArgs e)


{
lblDateTime.Text = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss tt");
}

private void panel1_Paint(object sender, PaintEventArgs e)


{

private void label2_Click(object sender, EventArgs e)


{

private void button3_Click(object sender, EventArgs e)


{
Application.Exit();
}

private void radioButton2_CheckedChanged(object sender, EventArgs e)


{

private void label8_Click(object sender, EventArgs e)


{

private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)


{

private void button2_Click(object sender, EventArgs e)


{
DateTime sdt = dateTimePicker1.Value.Date;
DateTime edt = dateTimePicker2.Value.Date;

TimeSpan ts = edt - sdt;

int days = ts.Days;

textBox2.Text = days.ToString();

private void button1_Click(object sender, EventArgs e)


{
MessageBox.Show("No selected type of payment");
}
}
}

You might also like