Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Trip Calculator Windows application that can be used to determine miles per gallon for a given trip. Set the Form object properties of

Create a Trip Calculator Windows application that can be used to determine miles per gallon for a given trip. Set the Form object properties of Name, ForeColor, BackColor, Size, Location, Text and AcceptButton. The form should contain labels and textboex to allow the user to input trup destination, miles traveled, and gallons of gas consumed. Two buttons should be placed on the form. Name all objects used in program statements. When the user clicks the button that performs the calculations, display in a label the miles per gallon for that trip. The second button should be used to reset or clear textbox entries. 3.Graphic user interface:

The answer so i have is below but it does not run the program please help.

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 Trip_Calculator { public partial class Form1 : Form { string prompt = "Enter your destination here..."; public Form1() { InitializeComponent(); }

private void Form1_Load(object sender, EventArgs e) { txtbxDestination.Text = prompt;

}

private void btnCalculateMPG_Click(object sender, EventArgs e) { lblMPH.Text = "Miles per gallon:" + Convert.ToString(Convert.ToDouble(txtbxMilesTraveled.Text)/Convert.ToDouble(txtbxGallonsConsumed.Text)); }

private void btnReset_Click(object sender, EventArgs e) { txtbxMilesTraveled.Text = null; txtbxGallonsConsumed.Text = null; lblMPH.Text = null; txtbxDestination.Text = prompt; txtbxDestination.Focus();

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Case Studies In Business Data Bases

Authors: James Bradley

1st Edition

0030141346, 978-0030141348

Students also viewed these Databases questions

Question

1. Is this appropriate?

Answered: 1 week ago