EBK STARTING OUT WITH VISUAL C#
EBK STARTING OUT WITH VISUAL C#
5th Edition
ISBN: 9780135204818
Author: GADDIS
Publisher: VST
Question
100%
Book Icon
Chapter 4, Problem 5PP
Program Plan Intro

Distance converter

Program plan:

Design the form:

  • • Place a one text boxes control on the form, and change its name and properties to get the distance from the user.
  • • Place a three label boxes control on the form, and change its name and properties.
  • • Place a two group boxes control on the form, and change its name and properties.
  • • Place a two list boxes control on the form, and change its name and properties to list of items.
  • • Place a command button on the form, and change its name and properties to convert distance and then display it.
  • • Place a command button on the form, and change its name and properties to end the application.

In code window, write the code:

Program.cs:

  • • Include the required libraries.
  • • Define the namespace “DistanceConverter”.
    • ○ Define a class “Program”.
      • ■ Define a constructor for the class.
      • ■ Define required functions to run “Form1”.

Form1.cs:

  • • Include the required libraries.
  • • Define namespace “DistanceConverter”.
    • ○ Define a class “Form1”.
    • ○ In btnConvert() method,
      • ■ Declare the required variables.
      • ■ Check whether selected index for From list and To list is not equal to “-1”. If yes, display the result.
      • ■ Otherwise, check whether From list is equal to “Yards” and To list is equal to “Feet”. If yes, calculate the distance in feet and display the result.
      • ■ Otherwise, check whether From list is equal to “Feet” and To list is equal to “Yards”. If yes, calculate the distance in yards and display the result.
      • ■ Otherwise, check whether From list is equal to “Yards” and To list is equal to “Inches”. If yes, calculate the distance in inches and display the result.
      • ■ Otherwise, check whether From list is equal to “Inches” and To list is equal to “Yards”. If yes, calculate the distance in yards and display the result.
      • ■ Otherwise, check whether From list is equal to “Feet” and To list is equal to “Inches”. If yes, calculate the distance in inches and display the result.
      • ■ Otherwise, check whether From list is equal to “Inches” and To list is equal to “Feet”. If yes, calculate the distance in feet and display the result.
    • ○ In btnClose() method,
      • ■ Close the application.

Form Design:

View the Form Design in IDE.

EBK STARTING OUT WITH VISUAL C#, Chapter 4, Problem 5PP

Set the Form Control properties in Properties window as follows:

ObjectPropertySetting
Form1TextDistance Converter
label1TextEnter a distance to convert:
label2TextConverted Distance:
lblResultText(Empty)
textBox1Text(Empty)
groupBox1TextFrom
groupBox1TextTo
FromItems 
 (Collection)Inches
Feet
Yards
ToItems 
 (Collection)Inches
  Feet
  Yards
btnConvertTextConvert
btnExitTextExit
  • • Add three label box controls to the form from Toolbox.
  • • Add one text box to the form from Toolbox.
  • • Add two group boxes to the form from Toolbox.
  • • Add two list boxes to the form from Toolbox.
  • • Add two command boxes to the form from Toolbox.

Blurred answer
Students have asked these similar questions
Subject: Database management system Explain in easy way with write  handwritten note   Test if the following schedule is conflict serializable or not and explain R1 (A), R2 (D), W1 (B), R2 (B), W3 (B), R4 (B), W2 (C), R5 (C), W4 (E), R5 (E), W5 (B).
Subject: Database management system Explain in easy way with write  handwritten note   Test if the following schedule is conflict serializable or not and explain R1 (A), R2 (D), W1 (B), R2 (B), W3 (B), R4 (B), W2 (C), R5 (C), W4 (E), R5 (E), W5 (B).
Subject: Database management system Explain in easy way with write  handwritten note a. What is lossy decomposition? Check whether the following decompositions are lossy or lossless. (i) Let R=ABCD, R1 = AD, R2 = AB, R3 = BE, R4 = CDE, R5 = AE, F={ A->C, B- >C, C->D, DE->C, CE->A} (ii) R (XYZWQ), FD= {X->Z, Y->Z, Z->W, WQ->Z, ZQ-> X, R1 (XW), R2 (XY), R3 (YQ) , R4 (ZWQ), R5 (XQ) b. Eliminate redundant FDs from (i) F={X->Y, Y->X, Y->Z, Z->Y, X->Z, Z->X} (ii) F = {X->YZ, ZW->P, P->Z, W->XPQ, XYQ, YW, WQ ->YZ}

Chapter 4 Solutions

EBK STARTING OUT WITH VISUAL C#

Ch. 4.3 - Convert the following set of nested if-else...Ch. 4.4 - Prob. 4.12CPCh. 4.4 - Prob. 4.13CPCh. 4.4 - Assume the variables a = 2, b = 4, and c = 6....Ch. 4.4 - Explain how short-circuit evaluation works with...Ch. 4.4 - Write an if statement that displays the message...Ch. 4.4 - Write an if statement that displays the message...Ch. 4.5 - Prob. 4.18CPCh. 4.5 - Prob. 4.19CPCh. 4.6 - If the following code were part of a complete...Ch. 4.6 - If the following code were part of a complete...Ch. 4.7 - Prob. 4.22CPCh. 4.7 - If a TryParse method successfully converts the...Ch. 4.7 - Prob. 4.24CPCh. 4.7 - Prob. 4.25CPCh. 4.9 - Prob. 4.26CPCh. 4.9 - If several CheckBox controls have been created in...Ch. 4.9 - Prob. 4.28CPCh. 4.10 - Convert the following if-else-if code to a switch...Ch. 4.11 - Prob. 4.30CPCh. 4.11 - Prob. 4.31CPCh. 4.11 - Prob. 4.32CPCh. 4 - A __________ structure executes a set of...Ch. 4 - A __________ structure provides one alternative...Ch. 4 - A(n) __________ expression has a value of either...Ch. 4 - The symbols , , and == are all __________...Ch. 4 - A __________ structure tests a condition and then...Ch. 4 - You use a(n) __________ statement to write a...Ch. 4 - You use a(n) __________ statement to write a dual...Ch. 4 - A ____________ decision structure is written...Ch. 4 - , ||, and ! are __________ operators. a....Ch. 4 - A compound Boolean expression created with the...Ch. 4 - A compound Boolean expression created with the...Ch. 4 - The __________ operator takes a Boolean expression...Ch. 4 - A __________ is a Boolean variable that signals...Ch. 4 - Prob. 14MCCh. 4 - Prob. 15MCCh. 4 - Prob. 16MCCh. 4 - The __________ section of a switch statement is...Ch. 4 - A ListBoxs index numbering starts at __________....Ch. 4 - You can use the __________ property to determine...Ch. 4 - The __________ property holds the item that is...Ch. 4 - Prob. 1TFCh. 4 - A single-alternative decision structure tests a...Ch. 4 - The if-else statement is a dual-alternative...Ch. 4 - A decision structure can be nested inside another...Ch. 4 - A compound Boolean expression created with the ...Ch. 4 - Prob. 6TFCh. 4 - Multiple CheckBox controls in the same GroupBox...Ch. 4 - The test expression in a switch statement can be a...Ch. 4 - If an item is not selected in a ListBox, the...Ch. 4 - Prob. 10TFCh. 4 - What is meant by the term conditionally executed?Ch. 4 - You need to test a condition and then execute one...Ch. 4 - Briefly describe how the operator works.Ch. 4 - Briefly describe how the || operator works.Ch. 4 - Prob. 5SACh. 4 - What is a flag and how does it work?Ch. 4 - What are the two arguments that you pass to a...Ch. 4 - How do you determine in code whether a RadioButton...Ch. 4 - Prob. 9SACh. 4 - Prob. 10SACh. 4 - Write an if statement that assigns 20 to the...Ch. 4 - Write an if statement that assigns 0 to the...Ch. 4 - Write an if-else statement that assigns 0 to the...Ch. 4 - Write nested decision structures that perform the...Ch. 4 - Write an if-else statement that displays Speed is...Ch. 4 - Write an if-else statement that determines whether...Ch. 4 - Prob. 7AWCh. 4 - Rewrite the following if-else-if statement as a...Ch. 4 - Prob. 9AWCh. 4 - Roman Numeral Converter Create an application that...Ch. 4 - Mass and Weight Scientists measure an objects mass...Ch. 4 - Magic Dates The date June 10, 1960, is special...Ch. 4 - Color Mixer The colors red, blue, and yellow are...Ch. 4 - Prob. 5PPCh. 4 - Book Club Points Serendipity Booksellers has a...Ch. 4 - Software Sales A software company sells a package...Ch. 4 - Body Mass Index Program Enhancement In Programming...Ch. 4 - Change for a Dollar Game Create a change-counting...Ch. 4 - Fat Percentage Calculator One gram of fat has 9...Ch. 4 - Time Calculator Create an application that lets...Ch. 4 - Workshop Selector The following table shows a...
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning