Write an algorithm that converts linear measurement in feet

Assignment Help Data Structure & Algorithms
Reference no: EM13315163

Practice with Sequence

2. 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: EM13315163

Questions Cloud

Find the magnitude of the deuteron velocity vector : Suppose a neutron, traveling to the right at 1000 m/s, strikes a proton moving upward at 500 m/s. Find the magnitude and direction of the deuteron velocity vector
Penetration pricing-odd pricing and price lining : Penetration Pricing. This is giving only one set of price to fit all parts of the market, from the higher to the lower class. Its main objective is to increase sales volume and market share rather than to gain profit right away.
Find the work done by nonconservative forces : A 16000kg airplane lands with a speed of 92m/son a stationary aircraft carrier deck that is 115 mlong. Find the work done by nonconservative forces in stopping the plane
What was the vertical component of jill''s velocity : Jack and Jill ran up the hill at 3.5m/s . The horizontal component of Jill's velocity vector was 2.5m/s . What was the angle of the hill? What was the vertical component of Jill's velocity?
Write an algorithm that converts linear measurement in feet : Write an algorithm that converts a linear measurement in feet and inches into meters. One inch is equivalent to 2.54 centimeters.
Find the initial speed of the rock : A 0.26-kg rock is thrown vertically upward from the top of a cliff that is 32m high. Assuming that air resistance can be ignored, find the initial speed of the rock
What is the acceleration at the top of a jump : Consider a plane that flies due east on a trip, and then returns due west following the same exact route. Imagine also that there are no winds in each trip. Flying due east, the plane flies with the rotation of the Earth, while flying due west..
What must be the speed of the molecules of gas : The force of an explosion on the piston of a gasoline engine is due to the change of momentum of the gas particles. What must be the speed of the molecules of gas after the explosion
How far must this spring be stretched : A force of 4.7N is required to stretch a certain spring by 1.4cm, How far must this spring be stretched for its potential energy to be 0.025J

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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