Need help with Assignment - painter's activities

HELP - problems in programming

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

33 Replies - 1823 Views - Last Post: 08 June 2008 - 07:01 AM Rate Topic: -----

#1 shadow_7  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 05-June 08

Need help with Assignment - painter's activities

Post icon  Posted 05 June 2008 - 01:46 PM

/*
Progam name:Artist.ccp
Author: Ayden Fountain
Date: 14/5/2008
Purpose:develop a programme for a self employed painter
*/

#include <iostream.h>
#include <conio.h>
#include <cType.h>



int main ()
{
 char cType;
 int iTtol=0, iPtol=0, iStol=0, iTjob=0, iPjob=0, iSjob=0;
 int iTmin=0, iPmin=0, iSmin=0, imins=0;
 cout << "Please enter the activity \n";
 cout << "T is for travel, P is for painting S is for seting up \n";
 cin.seekg(0);
 cin >>cType;

  //cType = toupper(cType);

  cout << "please enter the minutes worked on each job \n";
  cin >>imins;
  while (imins !cin.good())
  {
		  cout << "error not correct value of minutes \n";
	  cin.seekg(0);
	  cin.clear();
		  cin >> cType;
	  }
 while (!((cType == 'T') || (cType == 'P') || (cType == 'S') || (cType == 'X')))
 {
 cout << "error incorrect input \n";
 cin.seekg(0);
 cin.clear();
 cin >> cType;
 //cType = toupper(cType);

 }
   iTtol++;
	if (cType == 'T')		  //these are not adding to each total
	{
			iTtol ++; 
	}
	else if (cType == 'P')
	{

			iPtol ++;
	}
	else (cType == 'S');
	{
			iStol ++;
	}
   while (!((cType == 'T') || (cType == 'P') || (cType == 'S') || (cType == 'X')))
 {
 cout << " error incorrect input";
 cin.seekg(0);
 cin.clear();
 cin >> cType;
 //cType = toupper(cType);
	}

float fTjob, fPjob, fSjob, fgrand;

if (fgrand)
{
fTjob =(iTjob)*0.5;



fSjob =(iSjob)*0.8;	   //my calculations for the pricing which aint working



fPjob =(iPjob*1.0);
}

 (fgrand=0);
float (fgrand = fTjob + fPjob + fSjob);
clrscr();
cout << "costs are " << fgrand;

getch();
}






here is my code im trying to make a program for class its description is
"A self employed painter and decorator has decided to charge her time at different rates, based on he differnt activities she undertakes.Her 3 main activities which will be charged are traveling,preparation and painting.

Each activity occurs for a certain number of minutes per day and she requires a programme which will work out the total charge for a days work.
Ulitmately she would like it to record a weeks worth of work, and include more work-codes, but you are to write a program which allows her to input a single letter code representing each of the three types of activity and the number of minutes she was engaged in that activity for just one day. she should be able to do this repeatedly untill an exit code is entered as the work-type code. she may enter the same code more than once.

the charges are
traveling-50c per min
preparation-80c per min
painting-$1.00 per min"
i wud really appricate help with this and i dnt expect you to do it id rather you more guide me on the right way so i can learn from this
thanks

Is This A Good Question/Topic? 0
  • +

Replies To: Need help with Assignment - painter's activities

#2 shadow_7  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 05-June 08

Re: Need help with Assignment - painter's activities

Posted 05 June 2008 - 02:34 PM

/*
Progam name:Artist.ccp
Author: Ayden Fountain
Date: 14/5/2008
Purpose:develop a programme for a self employed painter
*/

#include <iostream.h>
#include <conio.h>
#include <cType.h>



int main ()
{
 char cType;
 int iTtol=0, iPtol=0, iStol=0, iTjob=0, iPjob=0, iSjob=0;
 int iTmin=0, iPmin=0, iSmin=0, imins=0;
 cout << "Please enter the activity \n";
 cin.seekg(0);
 cin >>cType;

  //cType = toupper(cType);

  cout << "please enter the minutes worked on each job \n";
  cin >>imins;
  while (imins > 9 || !cin.good())
  if (cType != '7')
  {
		  cout << "error not correct value of minutes \n";
	  cin.seekg(0);
	  cin.clear();
		  cin >> cType;
	  }
 while (!((cType == 'T') || (cType == 'P') || (cType == 'S') || (cType == 'X')))
 {
 cout << "error incorrect input \n";
 cin.seekg(0);
 cin.clear();
 cin >> cType;
 //cType = toupper(cType);

 }
   iTtol++;
	if (cType == 'T')
	{
			iTtol ++;
	}
	else if (cType == 'P')
	{

			iPtol ++;
	}
	else (cType == 'S');
	{
			iStol ++;
	}
   while (!((cType == 'T') || (cType == 'P') || (cType == 'S') || (cType == 'X')))
 {
 cout << " error incorrect input";
 cin.seekg(0);
 cin.clear();
 cin >> cType;
 //cType = toupper(cType);
	}

float fTjob, fPjob, fSjob, fgrand;

if (fgrand)
{
fTjob =(iTjob)*0.5;



fSjob =(iSjob)*0.8;



fPjob =(iPjob*1.0);
}

 (fgrand=0);
float (fgrand = fTjob + fPjob + fSjob);
clrscr();
cout << "costs are " << fgrand;

getch();
}


sorry i entered it wrong but can some1 plz help me
Was This Post Helpful? 0
  • +
  • -

#3 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Need help with Assignment - painter's activities

Posted 05 June 2008 - 02:39 PM

We can help you, but you need to describe the problem that you are having or where in your assignment you are stuck.
Was This Post Helpful? 0
  • +
  • -

#4 shadow_7  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 05-June 08

Re: Need help with Assignment - painter's activities

Posted 05 June 2008 - 02:46 PM

lol well im only 17 n im new to programming so yea but my problem is that im tryn to get the program to add a T etc to the tTol so that it wud calculate a total for each activity but when i try it either comes out wit a 0 or a number that isnt relavant n ive been fiddling with it lately to try see if i can fix it but im outta ideas as my programming knowledge is limited
Was This Post Helpful? 0
  • +
  • -

#5 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3120
  • View blog
  • Posts: 19,165
  • Joined: 14-September 07

Re: Need help with Assignment - painter's activities

Posted 05 June 2008 - 04:51 PM

First off, you'll get better responses if your code does not have syntax errors or fails to include necessary information for a clean compile on the first run.

for example:

using namespace std;



is absent and thus your code will not compile--at all. Nothing turns me off helping someone that does not have a clean compile on the first run. At this point in the development of your software you should be asking logic questions or specific language questions.

If i understand what your assignment is, here is how I would do it:

/*
 * KYA
 * possible solution
 * 6-5-08
 */

#include <iostream>
using namespace std;

double CalculateTotal(int travel, int painting, int setUp);


int main ()
{
	//variable declaration
	char jobInput;
	double grandTotal = 0.00;
	int travelMin = 0, paintMin = 0, setMin = 0;
	bool notDone = true;

	//main input loop
	while (notDone) {
		cout << "Please enter the activity \n";
		cout << "T is for travel, P is for painting S is for seting up (X is the exit code) \n";
		cin >> jobInput;

		cout << "Enter the minutes worked on this particular section: ";
		switch (jobInput){
			cin.clear();
			case 'T':
				cin >> travelMin;
				travelMin = travelMin;
				break;
			case 'P':
				cin >> paintMin;
				paintMin = paintMin;
				break;
			case 'S':
				cin >> setMin;
				setMin = setMin;
				break;
			case 'X':
				cout << "\n\nThank you and have a good day";
				notDone = false;
				break;
			default:
				cout << "Bad input, begin again.\n";
				break;
		}//end switch
		
	}//end main while loop

	grandTotal = CalculateTotal(travelMin, paintMin, setMin);
	cout << "\n\nYour amount due today is: $" << grandTotal << "\n\n";
	system("pause");
	return 0;
}//end main()

double CalculateTotal (int travel, int painting, int setUp)
{
	double total = 0.00;
	total = ((travel * 0.5) + (painting * 1.0) + (setUp * 0.8));
	return total;
}



I'll leave it up to you to implement multiple entries of the same task within one day.
Was This Post Helpful? 0
  • +
  • -

#6 shadow_7  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 05-June 08

Re: Need help with Assignment - painter's activities

Posted 05 June 2008 - 05:06 PM

im sorry about my poor skills and i appriciate you taking the time out of your day to do this
Was This Post Helpful? 0
  • +
  • -

#7 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3120
  • View blog
  • Posts: 19,165
  • Joined: 14-September 07

Re: Need help with Assignment - painter's activities

Posted 05 June 2008 - 05:24 PM

Your skills aren't necessarily poor, I was just trying to give a helpful suggestion if you ever have future questions.
Was This Post Helpful? 0
  • +
  • -

#8 shadow_7  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 05-June 08

Re: Need help with Assignment - painter's activities

Posted 05 June 2008 - 05:42 PM

i know what u mean and thanks so what compiler do u use cause with yours im getting a error with the namespace std;

and its unable to call the system are these the things im ment to fix or are they just stuff my compiler cant do?
Was This Post Helpful? 0
  • +
  • -

#9 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3120
  • View blog
  • Posts: 19,165
  • Joined: 14-September 07

Re: Need help with Assignment - painter's activities

Posted 05 June 2008 - 06:17 PM

I'm using visual studio 2005, but all C++ compilers have the standard. Are you using a 'c' compiler?
Was This Post Helpful? 0
  • +
  • -

#10 shadow_7  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 05-June 08

Re: Need help with Assignment - painter's activities

Posted 05 June 2008 - 06:29 PM

im using borland C++ version 5.02 it was the one i got from the school
Was This Post Helpful? 0
  • +
  • -

#11 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3120
  • View blog
  • Posts: 19,165
  • Joined: 14-September 07

Re: Need help with Assignment - painter's activities

Posted 05 June 2008 - 06:30 PM

Ah, that explains the clrscr()

Ok, well, generic questions, do you have all the standard C++ libraries and such installed in the include or bin folder of the compiler directory?
Was This Post Helpful? 0
  • +
  • -

#12 shadow_7  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 05-June 08

Re: Need help with Assignment - painter's activities

Posted 05 June 2008 - 06:39 PM

ok there is alot in the include folder like ddraw,conio,cstring and the sort
Was This Post Helpful? 0
  • +
  • -

#13 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3120
  • View blog
  • Posts: 19,165
  • Joined: 14-September 07

Re: Need help with Assignment - painter's activities

Posted 05 June 2008 - 06:43 PM

You could try this:

Anywhere where cin/cout are used, put this in front of it:

std::
//example
std::cout << "blah blah";



You could try also:

#include <iostream.h>



Since you had that originally, but the manner of calling is depreciated in my opinion. Borland might like that better, I've never used it.
Was This Post Helpful? 0
  • +
  • -

#14 shadow_7  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 05-June 08

Re: Need help with Assignment - painter's activities

Posted 05 June 2008 - 06:54 PM

View PostKYA, on 5 Jun, 2008 - 06:43 PM, said:

You could try this:

Anywhere where cin/cout are used, put this in front of it:

std::
//example
std::cout << "blah blah";



You could try also:

#include <iostream.h>



Since you had that originally, but the manner of calling is depreciated in my opinion. Borland might like that better, I've never used it.


ok so if i was to try the
std::
//example
std::cout << "blah blah";



i would just put it at the top were i wud put the <iostream.h>
and since im not famillar wit std what would an example be cause i just tried the iostream.h and it gave the same effect as before so the other way mite work out better and is there an easier way to talk to u and i dnt mean to be intrusive by asking that
Was This Post Helpful? 0
  • +
  • -

#15 shadow_7  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 05-June 08

Re: Need help with Assignment - painter's activities

Posted 05 June 2008 - 10:37 PM

:D :D :D ok thank you so much i had to change a few little things to get it to work on my compiler but it fully works now thanks so much!!!
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3