Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > IT форум > Помощь студентам
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 05.11.2017, 07:04   #1
Lupusludens
 
Регистрация: 05.11.2017
Сообщений: 4
По умолчанию Нужно проверить домашнее задание по учебнику Тони Гаддиса до 14: 00 вскр 05 октября.

Есть сомнения в правильности аргументов в вызывающем и вызываемых модулях.


9. Paint Job Estimator
A painting company has determined that for every 115 square feet of wall space,
one gallon of paint and eight hours of labor will be required. The company charges
$20.00 per hour for labor. Design a modular program that asks the user to enter
the square feet of wall space to be painted and the price of the paint per gallon. The
program should display the following data:
● The number of gallons of paint required
● The hours of labor required
● The cost of the paint
● The labor charges
● The total cost of the paint job
A.:
Variant 1.
1 Constant Real SQUAREFEETPERGALLON_RATE = 115
2 Constant Real HOURSPERGALLON_RATE = 8
3 Constant Real DOLLARSPERHOUR_RATE = 20
4 Module main()
5 Declare Real totalSqFeetToBePainted
6 Declare Real gallonsOfPaintRequired
7 Declare Real hoursOfLaborRequired
8 Declare Real costOfThePaint
9 Declare Real priceOfThePaintPerGallon
10 Declare Real laborCharges
11 Declare Real totalCost
12 Call showIntro ()
13 Call totalSqFeetToBePainted (Real Ref totalSqFeetToBePainted)
13 Call gallonsOfPaintRequired (Real Ref totalSqFeetToBePainted)
14 Call hoursOfLaborRequired (Real Ref totalSqFeetToBePainted)
15 Call costOfThePaint (Real Ref totalSqFeetToBePainted)
16 Call laborCharges (Real Ref totalSqFeetToBePainted)
17 Call totalCost (Real costOfThePaint, laborCharges)
18 Call showGallonsOfPaintRequired (Real Ref totalSqFeetToBePainted)
19 Call showHoursOfLaborRequired (Real Ref totalSqFeetToBePainted)
20 Call showCostOfThePaint (Real Ref totalSqFeetToBePainted)
21 Call showLaborCharges (Real Ref totalSqFeetToBePainted)
22 CallshowTotalCost (Real costOfThePaint, laborCharges)
23 End Module
24 Module showIntro ( )
25 Display “This program calculates your expenses in $ based on”
26 Display ” 1. payments for the number of gallons of paint, 2. the hours of labor: 115 sq.feet per hour and per one galon”
27 Display “3. the cost of the paint, 4. the labor charges: $20.00 per hour, 5.the total cost of the paint job.”
28 End module
29 Module totalSqFeetToBePainted (Real Ref totalSqFeetToBePainted)
30 Display “Input total square feet to be painted”
31 Input totalSqFeetToBePainted
32 Set totalSqFeetToBePainted = totalSqFeetToBePainted
33 End Module
34 Module gallonsOfPaintRequired (Real Ref totalSqFeetToBePainted)
35 Display “Starting count gallons of paint required”
36 Set gallonsOfPaintRequired = totalSqFeetToBePainted / SQUAREFEETPERGALLON_RATE
37 End Module
38 Module hoursOfLaborRequired (Real Ref totalSqFeetToBePainted)
39 Display “Staring count of hours of labour required”
40 Set hoursOfLaborRequired = totalSqFeetToBePainted / SQUAREFEETPERGALLON_RATE * HOURSPERGALLON_RATE
41 End Module
42 Module costOfThePaint (Real Ref totalSqFeetToBePainted)
43 Display “Starting count the total cost of the paint in $”
44 Display “Input the price of the paint in $ per gallon”
45 Input priceOfThePaintPerGallon
46 Set costOfThePaint = totalSqFeetToBePainted / SQUAREFEETPERGALLON_RATE * priceOfThePaintPerGallon
47 End Module
48 Module laborCharges (Real Ref totalSqFeetToBePainted)
49 Display “Starting count the labor charges in $”
50 Set laborCharges = totalSqFeetToBePainted / SQUAREFEETPERGALLON_RATE * HOURSPERGALLON_RATE * Real DOLLARSPERHOUR_RATE
51 End Module
52 Module totalCost (Real costOfThePaint, laborCharges)
53 Display “Starting count the total cost in $”
54 Set totalCost = costOfThePaint + laborCharges
55 End module
56 Module showGallonsOfPaintRequired (Real Ref totalSqFeetToBePainted)
57 Display “The number of gallons of paint required is ” , gallonsOfPaintRequired
58 End Module
59 Module showHoursOfLaborRequired (Real Ref totalSqFeetToBePainted)
60 Display “The hours of labor required is ” , hoursOfLaborRequired
61 End module
62 Module showCostOfThePaint (Real Ref totalSqFeetToBePainted)
63 Display “The cost of the paint in $ is” , costOfThePaint
64 End Module
65 Module showLaborCharges (Real Ref totalSqFeetToBePainted)
66 Display “The labor charges in $ are” , laborCharges
67 End Module
68 Module CallshowTotalCost (Real costOfThePaint, laborCharges)
69 Display “The total cost of the paint job is” , totalCost
70 End module










Variant 2.
1 Module main ( )
2 Call showIntro ()
3 Call gallonsOfPaintRequired (Real Ref totalSqFeetToBePainted)
4 Call hoursOfLaborRequired (Real Ref totalSqFeetToBePainted)
5 Call costOfThePaint (Real Ref totalSqFeetToBePainted)
6 Call laborCharges (Real Ref totalSqFeetToBePainted)
7 Call totalCost (Real costOfThePaint, laborCharges)
8 Display “The number of gallons of paint required is ” , gallonsOfPaintRequired
9 Display “The hours of labor required is ” , hoursOfLaborRequired
10 Display “The cost of the paint in $ is” , costOfThePaint
11 Display “The labor charges in $ are” , laborCharges
12 Display “The total cost of the paint job is” , totalCost
13 End Module
` 14 Module showIntro ( )
15 Display “This program calculates your expenses in $ based on”
16 Display ” 1. your payments for the number of gallons of paint, 2. the hours of labor”
17 Display “3. the cost of the paint, 4. the labor charges, 5.the total cost of the paint job.”
18 End Module
19 Module gallonsOfPaintRequired (Real Ref totalSqFeetToBePainted)
20 Display “Starting count gallons of paint required”
21 Declare Real gallonsOfPaintRequired
22 Declare Real totalSqFeetToBePainted
23 Display “Input total square feet to be painted”
24 Input totalSqFeetToBePainted
25 Set gallonsOfPaintRequired = totalSqFeetToBePainted / 115
26 Display “The number of gallons of paint required is ” , gallonsOfPaintRequired
27 End Module
28 Module hoursOfLaborRequired (Real Ref totalSqFeetToBePainted)
29 Display “Staring count of hours of labour required”
30 Declare Real hoursOfLaborRequired
31 Declare Real totalSqFeetToBePainted
32 Display “Input total square feet to be painted”
33 Input totalSqFeetToBePainted
34 Set hoursOfLaborRequired = totalSqFeetToBePainted / 115 *8
35 Display “The hours of labor required is” , Set hoursOfLaborRequired
36 End Module
37 Module costOfThePaint (Real Ref totalSqFeetToBePainted)
38 Display “Starting count the total cost of the paint in $”
39 Declare Real costOfThePaint
40 Declare Real priceOfThePaintPerGallon
41 Declare Real totalSqFeetToBePainted
42 Display “Input the price of the paint in $ per gallon”
43 Input priceOfThePaintPerGallon
44 Display “Input total square feet to be painted”
45 Input totalSqFeetToBePainted
46 Set costOfThePaint = totalSqFeetToBePainted / 115 * priceOfThePaintPerGallon
47 Display “ The cost of the paint in $ is ” , costOfThePaint
48 End Module
49 Module laborCharges (Real Ref totalSqFeetToBePainted)
50 Display “Starting count the labor charges in $”
51 Declare Real laborCharges
52 Declare Real totalSqFeetToBePainted
53 Display “Input total square feet to be painted”
54 Input totalSqFeetToBePainted
55 Set laborCharges = totalSqFeetToBePainted / 115 * 8 * 20
56 Display “The labor charges in $ are ” , laborCharges
57 End Module
58 Module totalCost (Real costOfThePaint, laborCharges)
59 Display “Starting count the total cost in $”
60 Declare Real totalCost
61 Declare Real totalSqFeetToBePainted
62 Display “Input total square feet to be painted”
63 Input totalSqFeetToBePainted
64 Set totalCost = laborCharges + costOfThePaint
65 Display “The total cost of the paint job is” , totalCost
66 End module
Lupusludens вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
перевести из С++ в Java - домашнее задание Васо Помощь студентам 1 21.05.2015 20:59
Домашнее задание 10 класс Григорий Матеюнас Паскаль, Turbo Pascal, PascalABC.NET 19 18.12.2012 07:26
Домашнее задание)) pachalol Visual C++ 0 13.12.2012 22:46
Домашнее задание 11 класс! pascal011 Паскаль, Turbo Pascal, PascalABC.NET 1 12.09.2012 21:34
Домашнее задание дмитрий12123 Паскаль, Turbo Pascal, PascalABC.NET 4 03.09.2012 22:15