Class scope variables-helper methods

Assignment Help C/C++ Programming
Reference no: EM13859348

Objectives:

  • Class scope variables
  • Helper Methods

Program:  Design a C# Windows Application to compute the cost of manufacturing different objects. The object can be a cylinder, a cone or a prism with the equilateral triangular base. The user should enter the radius of the base (or the side of the base for prism), the height, and select the object via radio buttons. Then the user can click on the Compute button to compute the cost of manufacturing one object. The GUI of this lab is given in figure-1.

450_Windows Application.jpg

Named Constants: Declare two named constants with class scope:  PI = 3.14159, and unit price of the material used in manufacturing the objects = $2.50 per cubic inches.

Class Scope Variables:  Declare 3 class scope variables to count the number of cylinders, cones, and prisms processed (A Class scope identifier must be declared outside all methods, in Form1 class code).

Required Helper Methods:

NOTE: Precede the code for each helper method with a segment of comments, identifying the method's name, input parameters, output data type and task.

1) ValidateInput( )

a) Input: none

b) Output data type: bool

c) Task: Validate user's input based on following rules:

i. Input data entered for radius (or side) must be a real number, greater than 0.

ii. Height must be a real number; greater than 0.

iii. One of the shapes (radio buttons) must be selected.

In case of invalid input, inform the user, set the focus to the Textbox, and return false.

2) ComputeVolumeCylinder

a) Input: radius and height

b) Output data type: double

c) Task: Compute the volume of the cylinder with given radius and height. The formula is: Volume = πR2H. Return the volume as output.

2) ComputeVolumCone

a) Input: radius and height

b) Output data type: double

c) Task: Compute the volume of the cone with given radius and height. The formula is: Volume  = (1/3) πR2H. Return the volume as output.

d)      

3) ComputeVolumPrism

a) Input: side of the equilateral triangle at the base (3 sides are equal) and the height of the prism.

b) Output data type: double

c) Task: Compute the volume of the prism:

i. Invoke the helper method ComputeTriangleArea() to compute the area of the triangular base.

ii. Compute the volume  =   area of the base * height.

iii. Return the volume as output.

4) ComputeTriangleArea()

a) Input: 3 sides of the triangle

b) Output data type: double

c) Task: Compute the area of the triangle based on its three sides using Heron's formula. Return the area as output. The formula is:

721_Compute the area of the triangle.jpg

Where: a, b, c are the sides of the triangle.

Compute Button:

- Declare variables.

- Call ValidateInput( ) to validate input data. If data is not valid, do nothing.

- Store valid data in variables.

- If the selected object is a cylinder,

o Call ComputeVolumeCylinder ( )

o Update the counter ( increment # of cylinders processed by 1).

- Otherwise, if the object is a cone

o Call ComputeVolumeCone ( )

o Update the counter.

- Otherwise         // object must be a prism

o Call ComputeVolumePrism ( )

o Update the counter.

- Compute the cost = volume * unit price of the material (see named constant).

- Display the object's name, its volume, and the cost.

Stats Button:

Display number of cylinders, cones, and prisms processed. These are your class scope variables that should be updated in the click event of the Compute button.

Reference no: EM13859348

Questions Cloud

Determine the roots of the closed-loop transfer function : Develop an m-file to determine the roots of the closed-loop transfer function characteristic polynomial for K=1 and 5. For which values of K is the closed loop system stable
Example of a program that contains an algorithm : Provide an example of a program that contains an algorithm whose Big-Θ is exponential. Clearly explain what n represents in your program. Make some assumption about how long it would take to execute one of the operations that you are counting.
Determine the size of the project buffer : how you would use the project buffer to determine the point at which you would implement controls to correct an unacceptable project schedule variance. Determine the size of the project buffer.
Compare the calculated heat transfer values : Compare the calculated heat transfer values with those obtained from your electrical measurements. Explain the differences.
Class scope variables-helper methods : Design a C# Windows Application to compute the cost of manufacturing different objects. The object can be a cylinder, a cone or a prism with the equilateral triangular base. The user should enter the radius of the base (or the side of the base for..
Why is accounting for a manufacturing business : In your opinion, why is accounting for a manufacturing business more complicated than accounting for a merchandising business and provide three examples each of materials, labor costs, and factory overhead.
Draw isoquants for the firms production function : Say that technology is relatively labor intensive if it uses more labor to produce the same amount of output than the other technology. Which technology A or B is labor intensive?
Calculate equilibrium products at 500k for the reaction : Calculate equilibrium products at 500K for the reaction of 1 mole CO and 1 mole H2O according to the water-gas shift reaction (CO • H2O CO2 • H2) as a function of temperature four ways
Recognize the elements and correct use of a thesis statement : Recognize the elements and correct use of a thesis statement

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd