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

  Design of web pages

Explain how a web designer defines a page as XHTML as opposed to HTML and recognize two different types of XHTML standards.

  Converting arithmetic expression in reverse polish notation

Convert the following numerical arithmetic expression into reverse Polish notation and show the stack operations for evaluating the numerical result.

  Create algorithm which takes as inputs matrices

Create the algorithm which takes as inputs, matrices C, D, and vertex indices i and j, and returns minimum-cost path from vertex i to vertex j.

  What is the worst case of avl tree?

the binary tree can look like a linked list in the worst case. What is the worst case of AVL tree? To get an idea, do the following: What is the minimum # of nodes in each of the AVL trees with heights 2, 3, 4, and 5?Explain please.

  Question about java programming

Define a class named Document that have an instance variable of type String named text that stores any textual content for the file. Design a technique named toString that returns the text field and also include a method to set this value.

  Data structures and algorithms

Provides learners with an understanding of how data structures are used in algorithms and enables them to design and implement data structures

  Find the checksum field in a single parity bit scheme

Assume that the information content of a packet is the bit pattern 1111000010100101 and an even parity is being used

  Algorithm for finding smallest element in unsorted array

Consider the following algorithm for finding the smallest element in an unsorted array: RANDOMMIN(A[1 .. n]). What is the exact expected number of executions of line ( )?

  Homogeneous array

Assume that a homogeneous array with six rows and eight columns, is stored in row major order starting at address 20. If each entry in the array requires only one memory cell.

  How long would it take to fill the available storage space

How many cells can be in a computer's main memory if each cell's address can be represented by two hexadecimal digits? What if four hexadecimal digits are used? Explain your answer.

  Using quicksort with median-of-three

Show the steps in details of sorting {3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5} using quicksort with median-of-three partitioning and a cutoff 3 (if the elements are less than 3, using insertion sort).

  The definitions associated with graphs.

Understand the definitions associated with graphs. a. Connected undirected graph; loop and cycle; DAG; simple path; strongly connected graph; weakly connected graph; complete graph

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