Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

LAB : algorithm creation exercises

Objectives

In this lab assignment, students will learn:

- How to design algorithms for computer programs

- How to design steps for getting user input

- How to design steps for processing

- How to design steps for displaying output

Goals

In this lab assignment, students will demonstrate the abilities to:

- Design algorithms for computer programs

- Design steps for getting user input

- Design steps for processing

- Design steps for displaying output

Instruction and Exercises

Note: Read and understand the following. Then, you will be able to do the Exercises 1 and 2 by writing out the similar programming algorithms.

Here is an instructional example.

Develop the algorithms for paintEstimate.html and paintEstimate.php based on the following requirement:

Write a Web-based application for the King Painting company. The page provided by paintEstimate.html should ask the user for the length, width and height of a room. These inputs will be submitted to paintEstimate.php for processing.

This program will use these inputs to perform a series of calculations:

the area of each of the two long walls,

the area of each of the two wide walls,

the area of the ceiling,

the total area of the ceiling and the four walls combined.

The program should then calculate the cost of paint, cost of labor, and the total cost, based on the following charges:

a gallon of paint costs $17.00 and covers 400 square feet;

labor costs 25.00 an hour and it takes 1 hour to paint every 200 square feet.

The program should output the length, width, height, and total area of the room, followed by the paint cost, labor cost, and the total cost.

For example if the user inputs 20, 15, and 8 for the length, width, and height, the area of each of the two long walls will be 20*8 = 160, the area of each of the two wide walls will be 15* 8 = 120. The area of the ceiling will be 20* 15 = 200. The area of the four walls and ceiling combined will be 160 + 160 + 120 + 120 + 200 = 860.

The coverage will be 860/400 = 2.15, and the paint cost will be 2.15 * 17.00 = 36.55. the labor will be 860/200 = 4.3 hours, and the labor cost will be 4.3 * 25.00 = 107.50. The total cost will be 36.55 + 107.50 = 144.05.

Here is the answer to submit algorithm programming logic. It should be like this:

paintEstimate.html algorithm:

Prompt for length

Get length

Prompt for width

Get width

Prompt for height

Get height

Submit length, width,height to paintEstimate.php

END

paintEstimate.php algorithm:

Receive length, width, height from paintEstimate.html

areaLongWall = length * height

areaWideWall = width * height

ceilingArea = length * width

totalArea = (2 * areaLongWall) + (2 * areaWideWall) + ceilingArea

paintCost = totalArea / 400 * 17.00

laborCost = totalArea / 200 * 25.00

totalCost = paintCost + laborCost

Display length, width, height, totalArea, paintCost, laborCost, totalCost

END

Student should follow the algorithm coding format as above. And do the following two exercises. Save the coding work into Lab03.txt and submit the file via BlackBoard.

Exercise 1

Write a Web-based application that allows a customer to order any number of copies of your amazing SaveTheWorld software. The page provided by softwareOrder.html should ask the user for the number of copies and the required operating system. These inputs will be submitted to software - Order.php for processing.

The program should calculate

the subtotal for the order (each copy sells for 35.00);

a 7% tax (which is 0.07 times the subtotal);

the shipping the handling charge, which is 1.25 for each copy;

the total cost (the subtotal pus the shipping/handling charge plus the tax).

The program should display

the operating system,

the number of copies ordered,

the sub-total,

the tax,

the shipping/handling and the total cost.

For example if the user inputs 5 copies, the subtotal will be 5*35.00 = 175.00, the tax will be 12.25, the shipping/handling will be 6.25, and the total cost will be 193.50.

Exercise 2

Write a Web-based application that processes a ticket request for a performance. The page provided by event.html should ask the user for a name, phone number, and number of tickets. These inputs will be submitted to event.php for processing.

This program should calculate the cost off the tickets ($35.00 each). For example if the user requires 10 tickets the cost will be 10* 35, which is 350.

The program should display the name, phone number, number of tickets, and cost of the tickets.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93083265

Have any Question?


Related Questions in Computer Engineering

Has a recent drop in airplane passengers resulted in better

Has a recent drop in airplane passengers resulted in better on time performance? Before the recent downturn, one airline bragged that 92% of its flights were on time. A random sample of 165 flights completed this year re ...

Python programmingplease i would like some help in checking

Python programming Please I would like some help in checking if my source code for is susceptible to short-circuit evaluation.I don't need answers, I just need corrections. The source code is to check the integer parts o ...

Command to mail only the process id of running java program

Command to mail only the process ID of running Java program test to the email address (single line Unix)

Question 1 using the internet each member of your team

Question: 1. Using the Internet, each member of your team should read at least 3 academically reviewed articles on designing. Summarize the articles in 300 words or more. Provide appropriate reference. 2. Combine each su ...

Would be being proposed transfer scheme answer the problems

Would be being proposed transfer scheme answer the problem/s seen in the implementation of the TRAIN law? Explain why or why not in light of the ongoing 4Ps etc. What are some other tax reform in Collas-Monsod's wish lis ...

Question suppose your il license encodes your name sex and

Question : Suppose your IL license encodes your name, sex, and birthday month/year which can be used by police officers and bouncers to determine if you are who your license says you are. What kind of encoding would this ...

Need references for information for the following dealing

Need references for information for the following dealing with CSMS (Consolidated Sales and Marketing System Project) Produce a narrative which describes the added error-handling pathways that includes: an overview of th ...

How is international trade regulated what is involved in

How is international trade regulated? What is involved in "trade agreements"?

1i which of the following characterizes a market ordera a

1) i. Which of the following characterizes a market order? a) A market order, which is considered a small order, is when 100 shares of a stock are ordered b) A market order is when the investor specifies the maximum pric ...

Given the following table keynbspand fdsnbspnbsprepair

Given the following table, key and FDs,   REPAIR (RepairInvoiceNumber, RepairDate, RepairCost, RepairEmployeeName, RepairEmployeePhone, SerialNumber, Type, TankCapacity) Candidate Keys: RepairInvoiceNumber, and (RepairDa ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As