Hey I need help creating this code using Visual Studio (Basic) 2015 Fitness Worl
ID: 3796376 • Letter: H
Question
Hey I need help creating this code using Visual Studio (Basic) 2015
Fitness World Health Club is having its Weight Room tiled. The room is rectangular and must have
its walls covered with tile.
· The tile costs $30 per carton.
· One carton of tile will cover 25 square feet.
· The labor charge is $55 per carton of tile applied.
A program is needed to compute the total cost of the job (tile cost plus labor charge).
User inputs needed would be the dimensions of the room (length, width, height).
The outputs must be:
1. Area to be tiled in square feet,
2. The number of cartons of tile needed. (You cannot buy a partial carton so you must round
up to the next integer. A statement that will do this for you is
intCartons = CInt(Math.Ceiling(dblTotalArea / 25))
3. Cost of the tile,
4. Labor charge,
5. Total Cost of the Job (tile cost plus labor charge)
Notes:
· Remember to use text boxes to hold user inputs and labels to display outputs.
· Be sure to choose appropriate names for variables and other objects.
· Create Keyboard Access Keys (Alt key shortcuts) for the buttons and make the Calculate
button the Accept Button.
· Be sure the Tab Order is set properly.
· Use comments to document your work.
Sample of interface
R Tiling Cost Calculator X Length 30 Width 25 Height 42 Total Area 4620 Cartons Needed 185 Cost of Tile $5,550.00 Labor Cost $10.175.0 Total Job Cost $15,725.0 Calculate Clear ExitExplanation / Answer
/*C sharp code */
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 tilingCalc
{
public partial class Form1 : Form
{
int length, width, height, total_area, cartoon, cost_tile, labor_cost;
/* Closes an app */
private void button3_Click(object sender, EventArgs e)
{
this.Close();
}
/*Closes current app and invoke new object */
private void button2_Click(object sender, EventArgs e)
{
Form1 f = new Form1();
f.Show();
this.Dispose(false);
}
private void button1_Click(object sender, EventArgs e)
{
getData();
/* Calculate area and display them */
total_area = length * width * height;
text_area.Text = total_area.ToString();
/* Calculate cartoon no and display them */
cartoon = (int)(Math.Ceiling((decimal)((double)total_area / 25)));
text_cartoon.Text = cartoon.ToString();
/* Calculate tile cost and display them */
cost_tile = cartoon * 30;
text_tile_cost.Text = "$" + cost_tile.ToString() + ".00";
/* Calculate labor cost and display them */
labor_cost = cartoon * 55;
text_cost_labor.Text = "$" + labor_cost.ToString() + ".00";
/* Calculate total cost and display them */
text_total_cost.Text = "$" + (cost_tile + labor_cost).ToString() + ".00";
}
void getData()
{
try
{
if (text_length.TextLength != 0)
{
length = int.Parse(text_length.Text);
}
if (text_width.TextLength != 0)
{
width = int.Parse(text_width.Text);
}
if (text_height.TextLength != 0)
{
height = int.Parse(text_height.Text);
}
}
catch (Exception e)
{
MessageBox.Show("Invalid input");
}
}
public Form1()
{
InitializeComponent();
}
private void label3_Click(object sender, EventArgs e)
{
}
private void label1_Click(object sender, EventArgs e)
{
}
}
}
/* C Sharp design code */
namespace tilingCalc
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.calculate = new System.Windows.Forms.Button();
this.clear = new System.Windows.Forms.Button();
this.exit = new System.Windows.Forms.Button();
this.text_length = new System.Windows.Forms.TextBox();
this.text_width = new System.Windows.Forms.TextBox();
this.text_height = new System.Windows.Forms.TextBox();
this.text_area = new System.Windows.Forms.TextBox();
this.text_cartoon = new System.Windows.Forms.TextBox();
this.text_tile_cost = new System.Windows.Forms.TextBox();
this.text_cost_labor = new System.Windows.Forms.TextBox();
this.text_total_cost = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(27, 18);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(40, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Length";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(27, 50);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(35, 13);
this.label2.TabIndex = 0;
this.label2.Text = "Width";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(27, 84);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(38, 13);
this.label3.TabIndex = 0;
this.label3.Text = "Height";
this.label3.Click += new System.EventHandler(this.label3_Click);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(27, 139);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(56, 13);
this.label4.TabIndex = 0;
this.label4.Text = "Total Area";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(27, 166);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(90, 13);
this.label5.TabIndex = 0;
this.label5.Text = "Cartoons Needed";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(27, 195);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(60, 13);
this.label6.TabIndex = 0;
this.label6.Text = "Cost of Tile";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(27, 224);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(58, 13);
this.label7.TabIndex = 0;
this.label7.Text = "Labor Cost";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(27, 252);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(75, 13);
this.label8.TabIndex = 0;
this.label8.Text = "Total Job Cost";
//
// calculate
//
this.calculate.Location = new System.Drawing.Point(20, 292);
this.calculate.Name = "calculate";
this.calculate.Size = new System.Drawing.Size(60, 42);
this.calculate.TabIndex = 4;
this.calculate.Text = "Calculate";
this.calculate.UseVisualStyleBackColor = true;
this.calculate.Click += new System.EventHandler(this.button1_Click);
//
// clear
//
this.clear.Location = new System.Drawing.Point(103, 292);
this.clear.Name = "clear";
this.clear.Size = new System.Drawing.Size(74, 40);
this.clear.TabIndex = 5;
this.clear.Text = "Clear";
this.clear.UseVisualStyleBackColor = true;
this.clear.Click += new System.EventHandler(this.button2_Click);
//
// exit
//
this.exit.Location = new System.Drawing.Point(194, 292);
this.exit.Name = "exit";
this.exit.Size = new System.Drawing.Size(68, 40);
this.exit.TabIndex = 6;
this.exit.Text = "Exit";
this.exit.UseVisualStyleBackColor = true;
this.exit.Click += new System.EventHandler(this.button3_Click);
//
// text_length
//
this.text_length.Location = new System.Drawing.Point(138, 13);
this.text_length.Name = "text_length";
this.text_length.Size = new System.Drawing.Size(99, 20);
this.text_length.TabIndex = 1;
//
// text_width
//
this.text_width.Location = new System.Drawing.Point(138, 46);
this.text_width.Name = "text_width";
this.text_width.Size = new System.Drawing.Size(99, 20);
this.text_width.TabIndex = 2;
//
// text_height
//
this.text_height.Location = new System.Drawing.Point(138, 81);
this.text_height.Name = "text_height";
this.text_height.Size = new System.Drawing.Size(99, 20);
this.text_height.TabIndex = 3;
//
// text_area
//
this.text_area.Location = new System.Drawing.Point(138, 135);
this.text_area.Name = "text_area";
this.text_area.ReadOnly = true;
this.text_area.Size = new System.Drawing.Size(98, 20);
this.text_area.TabIndex = 0;
//
// text_cartoon
//
this.text_cartoon.Location = new System.Drawing.Point(138, 164);
this.text_cartoon.Name = "text_cartoon";
this.text_cartoon.ReadOnly = true;
this.text_cartoon.Size = new System.Drawing.Size(99, 20);
this.text_cartoon.TabIndex = 0;
//
// text_tile_cost
//
this.text_tile_cost.Location = new System.Drawing.Point(138, 192);
this.text_tile_cost.Name = "text_tile_cost";
this.text_tile_cost.ReadOnly = true;
this.text_tile_cost.Size = new System.Drawing.Size(98, 20);
this.text_tile_cost.TabIndex = 0;
//
// text_cost_labor
//
this.text_cost_labor.Location = new System.Drawing.Point(138, 222);
this.text_cost_labor.Name = "text_cost_labor";
this.text_cost_labor.ReadOnly = true;
this.text_cost_labor.Size = new System.Drawing.Size(98, 20);
this.text_cost_labor.TabIndex = 0;
//
// text_total_cost
//
this.text_total_cost.Location = new System.Drawing.Point(138, 252);
this.text_total_cost.Name = "text_total_cost";
this.text_total_cost.ReadOnly = true;
this.text_total_cost.Size = new System.Drawing.Size(99, 20);
this.text_total_cost.TabIndex = 0;
//
// Form1
//
this.AcceptButton = this.calculate;
this.ClientSize = new System.Drawing.Size(284, 361);
this.Controls.Add(this.text_total_cost);
this.Controls.Add(this.text_cost_labor);
this.Controls.Add(this.text_tile_cost);
this.Controls.Add(this.text_cartoon);
this.Controls.Add(this.text_area);
this.Controls.Add(this.text_height);
this.Controls.Add(this.text_width);
this.Controls.Add(this.text_length);
this.Controls.Add(this.exit);
this.Controls.Add(this.clear);
this.Controls.Add(this.calculate);
this.Controls.Add(this.label8);
this.Controls.Add(this.label7);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "Form1";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Button calculate;
private System.Windows.Forms.Button clear;
private System.Windows.Forms.Button exit;
private System.Windows.Forms.TextBox text_length;
private System.Windows.Forms.TextBox text_width;
private System.Windows.Forms.TextBox text_height;
private System.Windows.Forms.TextBox text_area;
private System.Windows.Forms.TextBox text_cartoon;
private System.Windows.Forms.TextBox text_tile_cost;
private System.Windows.Forms.TextBox text_cost_labor;
private System.Windows.Forms.TextBox text_total_cost;
}
}