Please Help

closed account (2Up4izwU)
i have to answer this:

Write an algorithm (without modules) that asks the user to input the elapsed time for an event in seconds. The algorithm then outputs the elapsed time in hours, minutes and seconds.
(For example, if the elapsed time is 9630, then the output is 2:40:30)
2. Rewrite the previous algorithm with three modules in addition to the Control module.
3. Translate the algorithm created in part 1 into a C++ program without functions.
4. Translate the algorithm created in part 2 into a C++ program with functions.

thx
I don't see a question.
closed account (2Up4izwU)
here is it:



Write an algorithm that calculates the water bill given the cubic feet of water used for DEWA, which charges the tenant one of the following:

a) A flat rate of dhs 15.00 for usage up to and including 1000 cubic feet.

b) dhs 0.0175 per cubic foot for usage over 1000 cubic feet and up to and including 2000 cubic feet.

c) dhs 0.02 per cubic foot for usage over 2000 cubic feet and up to and including 3000 cubic feet.

d) A flat rate of dhs 70.00 for usage over 3000 cubic feet.

2. Rewrite the previous algorithm with three modules in addition to the Control module.

3. Translate the algorithm created in part 1 into a C++ program without functions.

4. Translate the algorithm created in part 2 into a C++ program with functions.
We can't help you until you make an attempt at it. Posting "Here is my homework" will not get you answers, but if you encounter a problem along the way, and you post it with code, we can help. Like this:

1)Try homework.
2)Encounter problem
3)Try to solve problem
4)Look around forums
5)Post code in forums and say "I seem to have a problem with the for loop on line 18"
6)receive aid concerning the for loop on line 18
7)have a nice day
closed account (2Up4izwU)
ok i will do it

firstly give me some tips cause it is not quite clear ..
closed account (2Up4izwU)
buhahaha
i am the coming Steve Jobs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <iostream>

using namespace std;

int main()
{
    cout << "Enter the cubic feet of water that have been used:\n " ;
    double w_usage, bill;
    cin>>w_usage;


    if (w_usage<=1000)
    {
    cout<<"Your Bill is 15 dhs" ;

    }


else
{


if ( w_usage<=2000)
{
    bill= w_usage*0.0175;
    cout<<"Your Bill is:\n"<<bill<<endl;
}



else



if ( w_usage<=3000)
{
bill= w_usage*0.02;
    cout<<"Your Bill is:\n"<<bill<<endl;

}
else

{



  if (w_usage>3000)

    cout<<"Your Bill is 70 dhs" ;

}

}



    return 0;
}




closed account (2Up4izwU)
ok how can i write it with functions ??
closed account (2Up4izwU)
where are u guyz ?
You're already getting help for the same question over here: http://cplusplus.com/forum/general/68004/


EDIT: Oop, I see it's actually a different question. Never mind...

BTW, read though the short functions tut if you haven't: http://cplusplus.com/doc/tutorial/functions/

You want to create a function called maybe Calc_water_bill(w_usage) that takes w_usage as an argument, then returns the calculated total.
Last edited on
Do you know how to write a function?http://www.cplusplus.com/doc/tutorial/functions/
Topic archived. No new replies allowed.