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

  Creating a single table to hold the information

Think about a typical sales invoice that would include the given information. Create a single table to hold all of the information needed to store an invoice including this information.

  Testing item in array of member using sequential search

Look up each test item in array of member items, by using sequential search. What is the worst-case running time of it. (asymptotically, in terms of n and k)?

  Saving contents of the richtextbox by creating a program

Create the statements to save the contents of the RichTextBox named rtbCurrent. Show a SaveFileDialog named sfdCurrent to get the name of the document from the user.

  Write specifications using uml notation for a function

Write specifications using UML notation for a function that computes the sum of the first five positive integers in an array of  n  arbitrary integers.

  Greedy strategy for finding a shortest path

Think about the given greedy strategy for finding a shortest path from vertex start to vertex goal in a connected graph.

  Deliverable is to design an algorithm

Deliverable is to design an algorithm for a function that accepts an integer array as an argument and returns the total of values in the array. this is algorithm

  Write a c++ program that creates and populate a tree

Write a C++ program that creates and populate a tree for an arithmetic expression. Then it should perform an in-order and a post-order traversal on the tree. The input of the program will be a text file with the arithmetic expressions in RPN.

  Devise algorithm to generate access control matrix

Devise an algorithm that generates an access control matrix A for any given history matrix H of the Chinese Wall model. A significant portion of the grade for this problem involves your justification of your algorithm.

  Explain sorting algorithm which is optimal in cost

Explain a sorting algorithm which is optimal with respect to this cost model and uses O(n) space. That is, time used by algorithm should exactly match lower bound

  System analyst

A huge, well regarded supplier of key raw materials to your corporation's production process requires a year-end summary report of totals purchased from it.

  Design algorithms to implement stack operations

How to design algorithms to implement stack operations. Write down the program to multiply any two matrices. (Using Basic).

  Discuss the issues involved in managing software selection

Prepare a PowerPoint presentation which summarizes the background, requirements, analysis and reasons for your choice. Alternative presentation formats such as Prezi are acceptable

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