The One-Stop Software Outsourcing Solution  

Login

Custom Software Buyers
Request new bids
Search Coders
My Account
 
My General Info
 
My bid requests
  My escrow account
 
Help for Buyers
Articles for Buyers
 

Custom Software Coders

Newest open work
Browse all work
Search all work
My Account
 
My General Info
 
My bids
  My credit account
 
Help for Coders
Articles for Coders
 

Affiliates

My account
 
My pipeline
 
My credit account
 
Help for Affiliates
 
Newest Open Bid Requests.
911 Emergency Help!
By warplanes on 6/14
Max Bid: $50


Webchat Enhancements
By Awesome3 on 6/14
Max Bid: $100


Free mailer
By stepin on 6/14
Max Bid: Open to fair suggestions


icq program
By stepin on 6/14
Max Bid: Open to fair suggestions


Interchangeable Manual and Computerized Accounts R ...
By Harry Ditmore on 6/14
Max Bid: $100


3-D data plots
By egreene on 6/14
Max Bid: Open to fair suggestions


Flash Intro
By Shoutmaster on 6/14
Max Bid: Open to fair suggestions


Software online help
By P-A-U-L on 6/14
Max Bid: $200


Flash/HTML Web Site
By Shoutmaster on 6/14
Max Bid: Open to fair suggestions


Click here to put this ticker on your own site

Open Work Categories
Database 
Documentation 
Graphics / Art 
   3d Animation 
   Art Misc. 
Language Specific 
   ASP 
   C# 
   C++ / C 
   Cold Fusion 
   Delphi 
   Java 
   Perl 
   PHP 
   XML/XSL 
   Visual Basic 
   Visual Basic .Net 
   Other 
Misc 
   Security 
MultiMedia 
Network 
   Network Design 
   Network Implementation 
Platforms 
   Windows 
     Exchange 
     Other 
   Internet Browser 
   UNIX 
   Hand Held/PDA Programming 
Requirements 
Testing / Quality Assurance 
Web 
   Page Design 
   Flash 
Training 
   Computer Based 
 
Other
 
Other Sites

Download the free Rent A Coder IE toolbar!
 
Show Bid Request

A time class
Bid Request Id: 5890
Bookmark
Posted by: walla (8 ratings)
(Software buyer rating 10)
Posted: 12/2/2001 4:22:31 PM EST
Bidding Closes: 12/5/2001 4:23:12 PM EST
Viewed: 143 times
Phase:
100% of work was accepted by buyer. Coder account has been credited.
Max Accepted Bid: Bidding is closed
Project Type: Personal Project / Homework Help
Bidding Type: Open Auction
Categories: C++ / C
Enter chat room for this bid request
(0 active users)

Description:
Create a class that holds times: 4:15 AM, 12:03 PM, 7:59 AM, etc. Each object should hold the hour, minute and meridian of a single time. Private data, then, would be:

long hr, min;
char meridian[5];

Meridian would hold either "AM" or "PM" (don't use lower case). hr would hold a number from 0-11 (although users would use 12 for 12 o'clock, not 0, and your functions should convert internally), min would hold a value from 0-59.

Any member functions that set times or compute times should check for valid values of hr and min and, if they are illegal or out of range, issue an error statement and set the time to 12:00 AM.

Member Functions:

void Set(long h, long m, char mer[]);
void Set(char string_time[]);

Two functions to set the times.

The first Set() two ints, h and m, and after checking that the values are in range, it sets the private data.

The second Set() takes a string like "10:32 AM" or " 4:05 PM" and uses it to set the time by:

1) confirming the correct general format
length of string_time should be 8
string_time[2] should be a ':'
string_time[7] should be a 'M'
if not, it prints an error message and returns
2) isolating the hour string, minute string and meridian into their own local string objects
3) converting the hour and minute string to numeric ints
4) checking that hour and minute are within legal range (and printing an error and returning if not)
5) setting the time using the non-string method.

Deliverables:
Constructor:

Time(long h = 12, long m = 0, char mer[] = "AM");
Time(char string_time[]);

These work like Set(). Be efficient in the design of these two functions.

void Add( long hour, long minute );

Adds the hour/minute to the current time. It must properly handle carries of minutes to hours, and AM to PM.

void Tick();

Adds a minute to the time, handling carries correctly.

bool Equals(Time t);

Returns true or false, depending on whether t == the time or not.

void Show();

Prints out the time.

Here is a sample main() and output that you can use to test your class, but hand in a sample main that is not exactly the same as this.

int main()
{
Time t1, t2 =" 5:05 PM", t3(12,12,"AM"), t4 = "2:03 AM";

t1.Show(); cout << endl;
t2.Show(); cout << endl;
t3.Show(); cout << endl;
t4.Show(); cout << endl;

t1.Add(10,50);
t2.Add(10,50);
t3.Add(10,50);

t1.Show(); cout << endl;
t2.Show(); cout << endl;
t3.Show(); cout << endl;

// correct the intentional error above t4.Set("11:45 PM");

Time alarm("12:05 AM");
cout << endl << "Starting Timer ... " << endl;
while ( !t4.Equals(alarm) )
{
t4.Tick();
t4.Show(); cout << endl;
}

return 0;
}

/* ------------------- SAMPLE RUN ---------------

Illegal time in Set()
12:00 AM
5:05 PM
12:12 AM
12:00 AM
10:50 AM
3:55 AM
11:02 AM

Starting Timer ...
11:46 PM
11:47 PM
11:48 PM
11:49 PM
11:50 PM
11:51 PM
11:52 PM
11:53 PM
11:54 PM
11:55 PM
11:56 PM
11:57 PM
11:58 PM
11:59 PM
12:00 AM
12:01 AM
12:02 AM
12:03 AM
12:04 AM
12:05 AM

---------------------------------------------- */

Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. Complete copyrights to all work purchased.


Remember that contacting the other party outside of the site (by email, phone, etc.) on all business projects < $500 (before the buyer's money is escrowed) is a violation of both the software buyer and seller agreements. We monitor all site activity for such violations and can instantly expel transgressers on the spot, so we thank you in advance for your cooperation. If you notice a violation, you can report it to: abuse@rentacoder.com.
 
Bidding/Comments:
All monetary amounts on the site are in United States dollars.
Rent a Coder is a closed auction, so coders can only see their own bids and comments. Buyers can view every posting made on their bid requests.

See all rejected bids (and all comments)
Name Bid Amount Date Coder Rating
This bid was accepted by the buyer!
Sammy Leong
(78 ratings)
in Scarborough, Ontario
Canada
$30 12/2/2001 9:11:57 PM EST  9.96
(Excellent)
   
 




Quick Search
 

 Advanced Search
Newest Open Work

 

 
Rent A Coder upholds the rigorous business practices required to be both a BBB member and Square Trade vendor.
  • All customer issues addressed within 2 days
  • Openly disclosed pricing and return policies
  • Participation in mediation at buyer request
  • Superior selling track record
This site is verified through it's parent company, Exhedra Solutions, Inc.
 

Rent A Coder Top Coders.


Anuj Gakhar
Rated a 9.96 on 44 jobs 
felichko
Rated a 10 on 13 jobs 
Sreeny
Rated a 9.87 on 28 jobs 
psycode
Rated a 9.89 on 20 jobs 
Sammy Leong
Rated a 9.96 on 79 jobs 
Theo Kandilioti s
Rated a 10 on 20 jobs 
Michael Sharp
Rated a 9.95 on 82 jobs 
Cyquester Technologi es
Rated a 10 on 54 jobs 
RNA
Rated a 9.8 on 13 jobs 
NovaSoftek
Rated a 10 on 4 jobs 

See all top coders...

What makes a top coder?
 
Other
Rent A Coder is PayPal verified through it's parent company, Exhedra Solutions, Inc.

Created in partnership with:

 
In memory of the victims and the courageous rescuers of 9/11/2001


Affiliate Sites



About Us | Kudos | Feedback    Affiliates | Advertise    Privacy | Legal

Copyright © 2001, Exhedra Solutions, Inc. All rights reserved.
By using this site you agree to its Terms and Conditions.
"Rent A Coder" (tm) and "Safe Project Escrow" is a trademark of Exhedra Solutions, Inc.