Find Jobs
Hire Freelancers

An Object-Oriented Program

$30-75 USD

Ολοκληρώθηκε
Αναρτήθηκε πάνω από 22 χρόνια πριν

$30-75 USD

Πληρωμή κατά την παράδοση
Create a class, Phone, that has three types of private data: ## Deliverables 1) A phone number, made up of three integers: area_code (3 digits), prefix (3 digits), last_four (4 digits). In other words, if the number for a phone object was to be (650)949-7777, then area_code=650, prefix=949, and last_four=7777. 2) Two per/minute rates (doubles): one local and one long distance: local_rate: basic charge for local calls, per minute. ld_rate: basic charge for long distance calls, per minute. These rates will be modified under certain conditions listed below. 3) Values (doubles) that constantly change: local_minutes: the number of local minutes that this phonehas used since last bill. ld_minutes: the number of long distance minutes that this phone has used since last bill. total_charges: the accumulated charges since the last bill. Public member functions: void Phone::Init(long ac, long pfx, long last4 This method will set the phone number to the arguments passed in and all the remaining private members to 0. This could be done by a constructor, althought we have not officially had them yet, so we can use an ordinary member function for this assignment. ----- void Phone::SetCharges( double local_rt, double ld_rt ) This method will set the local_rate and ld_rate according to the values passed in. If either argument is negative, it prints an error and does not change the private members. ----- void Phone::MakeCall( Phone callee, long duration_in_secs ) The most complex of the member functions, this method will compute the charges for a single call to callee that lasts duration_in_secs seconds. The algorithm for this function is as follows: The object that is used to call this function is the call-er. The first parameter is the call-ee, that is, the number that the caller is calling. If the area code of the callee and the object doing doing the calling (the call-ER) are the same, the local_rate applies. If the area code of the callee and the object doing doing the calling (the call-ER) are different, the ld_rate applies. Further adjustments to the rate must then be made: For local calls, if the prefix of the callee differs from the prefix of the caller by more than 200 then the local_rate should be doubled. e.g., (650) 949-7384 and (650)949-5250 would be local_rate, while (650) 949-7384 and (650)748-5610 would be 2*local_rate. For long distance calls, if the area code of the callee differs from the area code of the caller by more than 200 then the ld_rate should be doubled. e.g., (650) 949-7384 and (464)850-5250 would be ld_rate, while 650) 949-7384 and (408)555-5610 would be 2*ld_rate. Once the rate for the call is determined, the charge for that one call should be calculated and added to the accumulated total_charges for that month. ----- void Phone::PrintBillAndReset(); This should report the summary of charges for the month by printing the total charges and the number of local and long-distance minutes used. It should also clear out these three values in preparation for a new month of billing. Test this out by creating several (3 - 5) Phone objects and having them call each other. They should be in various area codes and prefixes (although at least 2 should be local to each other). Print out the phone bill for these Phones, then make a call or two more, and print again to confirm that the old charges were erased when the first bill was printed. Here is an example of the start (but not completion!) of a main that tests this class: ----------------- Phone me, mom, dad, flynn, tenya; [login to view URL](415, 435, 9792); [login to view URL](415, 940, 6654); [login to view URL](561, 324, 7693); [login to view URL](561, 320, 1208); [login to view URL](969, 234, 1221); [login to view URL](.03, .10); [login to view URL](.03, .10); [login to view URL](.03, .10); [login to view URL](.04, .8); [login to view URL](.02, .15); [login to view URL]( mom, 300); [login to view URL]( mom, 240); [login to view URL]( dad, 121); // the main() function continues to go on and test ... // ... the test would consist of printing bills ... [login to view URL](); [login to view URL](); [login to view URL](); // etc ... // and checking that the output matches your program. ---------------------
Ταυτότητα εργασίας: 2830840

Σχετικά με την εργασία

20 προτάσεις
Απομακρυσμένη Εργασία
Ενεργός/ή 23 χρόνια πριν

Ψάχνεις τρόπο για να κερδίσεις μερικά χρήματα;

Πλεονεκτήματα πλειοδοσίας στο Freelancer

Καθόρισε τον προϋπολογισμό σου και το χρονοδιάγραμμα
Πληρώσου για τη δουλειά σου
Περίγραψε την πρόταση σου
Η εγγραφή και η πλειοδοσία σε εργασίες είναι δωρεάν
Βραβεύτηκε στον/στην:
Avatar Χρήστη
See private message.
$21,25 USD σε 14 ημέρες
5,0 (80 αξιολογήσεις)
5,2
5,2
20 freelancers δίνουν μια μέση προσφορά $39 USD για αυτή τη δουλειά
Avatar Χρήστη
See private message.
$42,50 USD σε 14 ημέρες
4,7 (48 αξιολογήσεις)
4,3
4,3
Avatar Χρήστη
See private message.
$34 USD σε 14 ημέρες
4,6 (7 αξιολογήσεις)
4,6
4,6
Avatar Χρήστη
See private message.
$55,25 USD σε 14 ημέρες
4,6 (14 αξιολογήσεις)
4,7
4,7
Avatar Χρήστη
See private message.
$42,50 USD σε 14 ημέρες
5,0 (16 αξιολογήσεις)
4,0
4,0
Avatar Χρήστη
See private message.
$46,75 USD σε 14 ημέρες
4,5 (33 αξιολογήσεις)
4,2
4,2
Avatar Χρήστη
See private message.
$38,25 USD σε 14 ημέρες
4,9 (7 αξιολογήσεις)
3,4
3,4
Avatar Χρήστη
See private message.
$22,95 USD σε 14 ημέρες
5,0 (10 αξιολογήσεις)
2,9
2,9
Avatar Χρήστη
See private message.
$55,25 USD σε 14 ημέρες
4,8 (21 αξιολογήσεις)
3,2
3,2
Avatar Χρήστη
See private message.
$42,50 USD σε 14 ημέρες
5,0 (3 αξιολογήσεις)
2,1
2,1
Avatar Χρήστη
See private message.
$14,45 USD σε 14 ημέρες
4,9 (6 αξιολογήσεις)
1,9
1,9
Avatar Χρήστη
See private message.
$63,75 USD σε 14 ημέρες
4,2 (12 αξιολογήσεις)
2,1
2,1
Avatar Χρήστη
See private message.
$42,50 USD σε 14 ημέρες
0,0 (0 αξιολογήσεις)
0,0
0,0
Avatar Χρήστη
See private message.
$51 USD σε 14 ημέρες
0,0 (0 αξιολογήσεις)
0,0
0,0
Avatar Χρήστη
See private message.
$25,50 USD σε 14 ημέρες
0,0 (0 αξιολογήσεις)
0,0
0,0
Avatar Χρήστη
See private message.
$21,25 USD σε 14 ημέρες
0,0 (1 αξιολόγηση)
0,0
0,0
Avatar Χρήστη
See private message.
$63,75 USD σε 14 ημέρες
0,0 (0 αξιολογήσεις)
0,0
0,0
Avatar Χρήστη
See private message.
$29,75 USD σε 14 ημέρες
0,0 (0 αξιολογήσεις)
0,0
0,0
Avatar Χρήστη
See private message.
$40,80 USD σε 14 ημέρες
0,0 (0 αξιολογήσεις)
0,0
0,0
Avatar Χρήστη
See private message.
$20,40 USD σε 14 ημέρες
0,0 (0 αξιολογήσεις)
0,0
0,0

Σχετικά με τον πελάτη

Σημαία της UNITED STATES
Carlsbad, United States
5,0
79
Επαληθευμένη μέθοδος πληρωμής
Μέλος από Οκτ 18, 2001

Επαλήθευση Πελάτη

Ευχαριστούμε! Σου έχουμε στείλει ένα email με ένα σύνδεσμο για να διεκδικήσεις τη δωρεάν πίστωση σου.
Κάτι πήγε στραβά κατά την προσπάθεια αποστολής του email σου. Παρακαλούμε δοκίμασε ξανά.
Εγγεγραμμένοι Χρήστες Συνολικές Αναρτημένες Δουλειές
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Φόρτωση προεπισκόπησης
Δόθηκε πρόσβαση για Geolocation.
Η σύνδεση σου έχει λήξει και τώρα έχεις αποσυνδεθεί. Παρακαλούμε συνδέσου ξανά.