# please I want from you help to do this home wrok

Show 80 post(s) from this thread on one page
Page 1 of 2 12 Last
• 01-04-2007
student C++
please I want from you help to do this home wrok
hello every body here

I am student in university and I need help for this home work because this homework

my teacher he will give me big mark if I did it very well and I need for this mark to pass

I tried to solve this home work but it very difficult for me I can't do it please I need the

1-Write a program that prompts the user to enter the number of required lines to draw an incrementing series of stars. The user should stop if 0 is entered.
Notice the stars are drawn after an indent of aproximately 2 taps.

++++++++++++++++++++++++++++++++++

2-A parking garage charges a \$2.00 minimum fee to park for up to three hours.
The garage charges an additional \$0.50 per hour for each hour or part of hour in excess of three hours. The maximum charge for any given 24 hour period is \$10.00. Assume that no car parks for longer than 24 hours at a time. Write a program that calculates and prints the parking charges for each of three customers who parked their cars in this garage yesterday.
You should enter the number of hours parked for each customer. Your program should print the results in a neat tabular format and should calculate and print the total of yesterday's receipts. The program should use a function calculateCharges to determine the charge for each customer. Your output should appear in the following format:

Enter the hours parked for three cars: 1.5 4.0 24.0

Car Hours Charge
1 1.5 2.00
2 4.0 2.50
3 24.0 10.00
TOTAL 29.5 14.50
Press any key to continue....

++++++++++++++++++++++++++++++++++++++++++
Hints:
• Use a for loop to prompt the user for the number of hours parked for each of the three customers.
• Declare variables to store the total number of hours and the total charges for each customer.
• The variables for all charges and numbers of hours should be of type double.
Function calculateCharges should use a nested if/else structure to determine the customer charge.

I wait you......
• 01-04-2007
rynoon
Could you post your code so far and explain your specific problems?
• 01-04-2007
Bench82
Quote:

Originally Posted by student C++
I tried to solve this home work but it very difficult for me

Could you show us your attempts to solve the problem?

Edit - Rynoon beat me to it that time!
• 01-04-2007
student C++
hi
This code for question 1

Code:

```#include<iostream> using namespace std; int main() {         int i;         for(i=0;i<=n;i++)                 cout<<"Enter number of lines (press 0 to quit):"<<endl;                                             if(n==0)                         cout<<"\n";         cout<<"Good_Bye\n";                 return 0; }```
• 01-04-2007
Bench82
That's a start I suppose. Did you try to compile it? You haven't declared n anywhere.
• 01-04-2007
rynoon
For question one you need to ask for the number of lines before you enter a loop. Consider the example output below.

Code:

```Enter the number of lines (press 0 to quit): 4   *   **   ***   **** Goodbye```
This is what you're trying to create. How are you going to print an incrementing number of stars on each line?
• 01-05-2007
student C++
Code:

```#include<iostream> using namespace std; int main() {         int i,j;                         do{                 cout<<"Enter number of lines (press 0 to quit):"<<endl;             cin>>i;             for(j=0;j<=i;j++)                                                                 * =(*+i);                 }while(i!=0);         cout<<"Good_Bye\n";                 return 0; }```
• 01-05-2007
Bench82
Quote:

Code:

`                * =(*+i);`

I'm not sure what you're doing here, but this isn't right!

a star is just another character, so output it the same way you'd output any other text.
• 01-05-2007
rynoon
Alright. You have to remember that a * is just a char. What do you do when you want to !-->"string"<--! more than one char together?
• 01-06-2007
Raigne
here is a little code
Code:

```#include <iostream> using namespace std; int main() {     int stars = 0;     int t_val = 0;     cout << "Enter the number of rows for incrementing stars: ";     cin >> ____;     for ( int x = 0; x != ____ + 1; ++x ) {         int temp = 0;         while ( x != temp ) {             ++temp;             ++____;             cout << "*";         }         cout << endl;     }     cout << "Number of rows: " << t_val << endl;     cout << "Total number of stars: " << stars << endl;     system("pause"); }```
I cut out a few sections so you will have to figure that part out, but if you add the right things back into it where there are underscores then this code works perfectly;
• 01-06-2007
swgh
Thw parking garage assignment is rather simple. Just a matter of passing the right argumement value back to the caller. You can solve almost all of this with if statements. I did somthing simular last year. One hint, use a loop to ensure the question if asked three times
• 01-06-2007
iMalc
Quote:

my teacher he will give me big mark if I did it very well and I need for this mark to pass
Quote:

Code:

`* =(*+i);`

For someone posting such random guesses at C++ syntax, it would be just plain wrong for your teacher to give you a pass at the moment. TANSTAAFL.
I think Raigne gave you way more than anyone should have.

Get yourself a good beginner C++ book or some absolute beginner web-based tutorials and spend some time learning the basics of the language.
• 01-07-2007
Raigne
Sorry about that, did I break the forum rules posting that if so I am sorry. Anyhow take iMalc's advice as it will do you alot of good. However if you are in college for programming why do you not notice the errors in your code?
• 01-07-2007
iMalc
Quote:

Originally Posted by Raigne
Sorry about that, did I break the forum rules posting that if so I am sorry. Anyhow take iMalc's advice as it will do you alot of good. However if you are in college for programming why do you not notice the errors in your code?

Probably borderline yeah, but you didn't give the whole answer, he still has to solve the second bit. Its hard to resist the urg eh!
Besides the teacher most likely need only ask him a basic question about his answer to determine that he doesn't understand it, and hence didn't write it.

Be careful not to let the language barrier get used as an excuse to jump more quickly to posting code instead of discussing the program logic. They can choose to post elsewhere, and often have, so the difficulty of communicating with English speakers was their chosen disadvantage.

I find that a general guideline is to never post more than about two consecutive lines of code in a response to homework. The bulk of it should be psuedo code and discussion.

Be especially weary of first-time posters.
• 01-07-2007
Raigne
Ah, I will do well to remember that, and maybe only explanations or pointers on what to do for now on. thanks for the info iMalc.
Show 80 post(s) from this thread on one page
Page 1 of 2 12 Last