Write an algorithm that converts a linear measurement

Assignment Help Programming Languages
Reference no: EM13186015

1. Write an algorithm that converts a linear measurement in feet and inches into meters. One inch is equivalent to 2.54 centimeters.

Algorithm:

1. Prompt user for LengthInFeet.

2. Get LengthInFeet.

3. Prompt user for LengthInInches.

4. Get LengthInInches.

5. LengthInMeters = ((LengthInFeet * 12) + LengthInInches) * 2.54 / 100.

6. Display LengthInMeters.

IPO Chart:

Input

LengthInFeet

LengthInInches

Processing

Get LengthInFeet and LengthInInches

Calculate ((LengthInFeet * 12) + LengthInInches) * 2.54 / 100

Save the result in LengthInMeters

Display LengthInMeters

Output

LengthInMeters

Test Data:

 

LengthInFeet

LengthInInches

LengthInMeters

Data set 1

5

10

1.778

Data set 2

38

7

11.7602

Data set 3

6

0

1.8288

Desk Check with first set of data

Step

LengthInFeet

LengthInInches

LengthInMeters

1

?

?

?

2

5

?

?

3

5

?

?

4

5

10

?

5

5

10

1.778

6

5

10

1.778

Desk Check with second set of data

Step

LengthInFeet

LengthInInches

LengthInMeters

1

?

?

?

2

38

?

?

3

38

?

?

4

38

7

?

5

38

7

11.7602

6

38

7

11.7602

Desk Check with third set of data

Step

LengthInFeet

LengthInInches

LengthInMeters

1

?

?

?

2

6

?

?

3

6

?

?

4

6

0

?

5

6

0

1.8288

6

6

0

1.8288

Practice with Selection

4. Write an algorithm that can be used to calculate the commission earned in a real estate transaction. The chart below describes the formulas used to calculate the commission.

Sales Price

Commission

Less than $100,000

5% of Sales Price

$100,000 to $300,000

$5,000 + 10% of Sales Price over $100,000

More than $300,000

$25,000 + 15% of Sales Price over $300,000

Algorithm:

1. Prompt user for SalesPrice.

2. Get SalesPrice.

3. If SalesPrice< 100000

Commission = 0.05 * SalesPrice

Else If SalesPrice<= 300000

Commission = 5000 + (0.1 * (SalesPrice - 100000))

Else

Commission = 25000 + (0.15 * (SalesPrice - 300000))

4. Display Commission.

IPO Chart:

Input

SalesPrice

Processing

Get SalesPrice

If SalesPrice< 100000

Commission = 0.05 * SalesPrice

Else If SalesPrice<= 300000

Commission = 5000 + (0.1 * (SalesPrice - 100000))

Else

Commission = 25000 + (0.15 * (SalesPrice - 300000))

Output

Commission

Test Data:

 

SalesPrice

Commission

Data set 1

80000

4000

Data set 2

232000

18200

Data set 3

780000

97000

Data set 4

300000

25000

Desk Check with first set of data

Step

SalesPrice

Commission

1

?

?

2

80000

?

3

80000

4000

4

80000

4000

Desk Check with second set of data

Step

SalesPrice

Commission

1

?

?

2

232000

?

3

232000

18200

4

232000

18200

Desk Check with third set of data

Step

SalesPrice

Commission

1

?

?

2

780000

?

3

780000

97000

4

780000

97000

Desk Check with fourth set of data

Step

SalesPrice

Commission

1

?

?

2

300000

?

3

300000

25000

4

300000

25000

Reference no: EM13186015

Questions Cloud

How many deer are in the preserve : to determine the number of deer in a game preserve, conservationist catches 524 deer, tags them and lets them loose. later 500 deer are caught, 250 of them are tagged. How many deer are in the preserve.
What is the required reserve ratio : A depository institution holds $150 million in Required Reserve and $10 million in Excess Reserves. Its remaining assets include $440 million in Loans and $150 million in Securities. If the institution's only liabilities are transaction deposits, ..
State two methods for determining hg in coal fly : Two methods for determining Hg in coal fly ash using atomic absorption were used to see if both methods would give the same results. In the first method only HNO3 is used for digestion,
At what rate is the plates area increasing : when a circular plate of metal is heated, its radius increases at a rate of 0.02cm/min. at what rate is the plate's area increasing when the radius is 52 cm?
Write an algorithm that converts a linear measurement : Write an algorithm that converts a linear measurement in feet and inches into meters. One inch is equivalent to 2.54 centimeters.
What is the difference in euac of new and existing machine : A manufacturer is considering replacing a production machine tool. A new machine tool will cost $37,000 and have a life of 4 years with no salvage value, and will save the company $5000 per year in direct labor costs and $2000 per year in operatin..
How many houses are available in each floor plan : Write an equation that illustrates this situation. Use the same variables you used in Part a. c. Use elimination to determine how many houses are available in each floor plan. Explain how you arrived at your answer.
Define chlorate candle : 1. How large (in kg) an oxygen candle (KClO3) would be needed to supply 8 people with enough oxygen for 24 hours on a small submarine. The average person needs .84 kg of O2 per day.
How fast is the water level rising : A swimming pool is 16 feet wide and has transverse cross-sections which look like: If the pool is being filled at a rate of 1.1 cubic feet per minute, how fast is the water level rising when the depth of water is 2 feet?

Reviews

Write a Review

Programming Languages Questions & Answers

  Facilitate overcoming limits of security-merchant risk

What features do they include to facilitate overcoming limits of security, merchant risk, cost, etc.? How do they validate cardholder identities?

  Create e-r diagram for sell and buy of antiques

Create E-R diagram for following situation (state any assumptions you believe you have to make to develop diagram): XYZ Antiques buys and sells one-of-a kind antiques of all kinds

  Write program which prints question and reads user input

Write the program which prints question "Do you want to continue?" and reads user input. If user input is "Y", "Yes", "OK", "Sure", or "Why not?", print out "OK".

  Write program to accept name and score of all batsmen

Write a program to accept name and score of all batsmen of a team and print them in the given manner: INPUT:names[]={nam1,nam2,nam3,nam4,nam5,nam6} & scores[]={48,65,73,10,90,84}

  Statement to assig nnew value to first element of array

Suppose that array of integers named a has been declared and initialized. Write single statement which assigns a new value to first element of the array.

  Calculate and print the annual salary of the employee

Calculate and print the annual salary of the employee. suppose employee receive 6% increase in pay. Calculate and print net pay giving the pay rate and hours work. Suppose deductions amount to 9% of the gross pay.

  Write program to allow two users to play tic-tac-toe

Write a program that will allow two users to play tic-tac-toe. The program should ask for moves alternately from player X and player O.

  Design-write program to enter score repetition structure

Design and write a program that asks the user to enter five test scores using a repetition structure. The program should display the letter grade for each score and the average test score at the end of the program.

  Write program to operate as point of sale application

Write down program which will operate as the point of sale (POS) application at carpet retailer. Carpet will be sold by square yard. Padding will be sold by square yard.

  Approach for building site in-house with existing staff

Web site Consider your options for building the site in-house with existing staff, or outsourcing the entire operation. Decide which strategy you believe is in your company's best interest and create a brief presentation outlining your position.

  Object-oriented analysis and design

Object-Oriented Analysis and Design,  PART B-object-oriented design involves the steps 13-18:

  Design application to allow user to input a price

Design an application that allows a user to input a price until an appropriate sentinel value is entered.Output is the price of each item on each day,one through seven.

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