GetACoder.com

 
 

Home | My Account | Post Job | Browse Jobs | RSS Feeds | Careers New!

 

Calculator Using Stack And Nodes

 
 
     
Job Summary:
 
Job Type: Project
Budget: $ 20-100
Required Skills: C++ / C, Programming
Attached Files: node2.h
node2.template
stack2.h
stack2.template
 
Status: Work Performed (selected user vanzolo)
 
Buyer Summary:
 
Username:
alven16  
Feedback Score: 10.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/10 1 reviews
Award Reliability: 1 posted 1 paid
 
Location: Sydney, NSW, Australia
Member Since: June 16, 2008
 
Invited Users: There are no invited users


Description
Objectives:
This assignment aims to review C++ skills or concepts including:
C++ classes
Separate compilation
Stacks
Command-line arguments
Reading from a file
Task: A Calculator Program
In this project, you will write a program that acts as a simple calculator.
Description
This program will be reading a file that contains an arithmetic expression on each line. The program evaluates these expressions and prints the values to cout.
The expressions will be postfix expressions (as described on pages 373--376 of the text). Your program will be implemented using a stack-based algorithm for evaluating an arithmetic expression.


Getting Started
Read all of Chapter 7, with particular attention to Section 7.4.
To help you get started, the following files will be supplied:

the stack header file stack2.h
the stack template file stack2.template
the node header file node2.h
the node template file node2.template
N.B.Your program must use this startup files in its implementation
This project requires you to read a file, specified in the command line arguments when the program is executed, and output the resulting answers to cout.

The input expressions contained in the file will be postfix expressions.
Use the evaluation algorithm from Figure 7.10 on page 376 of the text.

Additional Functions
Include the following three functions in your implementation
A function that opens a file for input and checks that the opening process did not fail. The specification for this function is:
void open_for_read(ifstream& f, const char filename[ ]);
// Postcondition: The ifstream f has been opened for
// reading using the given filename. If any errors
// occurred then an error message has been printed
// and the program has been halted.


A boolean function that determines whether a specified file still has valid input. The specification is:
bool is_more(istream& f);
// Postcondition: The return value is true if f still has
// more valid input to read; otherwise the return
// valid is false.


Notice that the data type of the argument is an "istream" rather than an "ifstream". An istream is usually an ifstream, although later you will learn of other kinds of istreams (such as cin). Istream arguments must always be reference parameters.


A function named process_line with this prototype:
void process_line(istream& f, bool& okay, double& answer);


One useful technique that you might use when you first start to implement this function is to firstly implement a simple version of the process_line function.
The simple version reads one input line, sets okay to true, and sets answer to 42.0 (Later you will implement a more complex version of the function that actually evaluates an arithmetic expression from the input line).
Put the simple version in your source code and change the body of the main function so that it does this:
Declares an ifstream variable called input and uses open_for_read to open input for reading. Use argv[1] as the name of the input file.
Have a loop that continues while there is more input. In the body of the loop, call process_line. If process_line sets okay to true then print the value of answer on the next output line; otherwise print the word INVALID on the next output line.
Close the input file and print a message saying that the program is done.
The possible errors that will cause okay to be set to false:
(a) division by zero,
(b) an operation symbol is read but the stack does not have at least two numbers,
(c) the entire expression has been read and evaluated but the numbers stack does not have exactly one number on it.

If an error is detected, be sure to continue to read the rest of the input line (up to and including the newline character).
Use input techniques similar to those in Figure 7.5 on pages 361-362.




Reminder
You may not start working in this and any request before your bid is accepted. Users who violate this policy may have their accounts permanently suspended.



 Bids Received (12)   Shortlist (0)   Declined Bids (0)   
Average bid amount:   $41.00   Average delivery time:   4 Day(s)
Place Bid | Post Similar Job | Send Request | Contact alven16

Order by:

 

Remember that contacting the other party outside the site (by email, phone, etc.) on all business jobs (before the request is awarded) is a violation of our terms of use. We supervise all site activity for such infringements and can immediately expel transgressors on the spot, so we thank you in advance for your cooperation. If you notice a violation please help out the site and report it. Thank you for your help.
 

 
send private message
Shortlist
Decline Bid
Premium User  
TechnoVilla  
Dhaka, BD
location
US$80
bid amount

9.97/109.97/109.97/109.97/109.97/109.97/109.97/109.97/109.97/109.97/10
(206 reviews)

feedback
3 day(s)
delivery time

 
 
Please check PM
Bid Time: 06-16-2008 07:36
 
send private message
Shortlist
Decline Bid
amrankuet  
Dhaka, BD
location
US$45
bid amount

10.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/10
(38 reviews)

feedback
2 day(s)
delivery time

 
 
Please Check PM.
Bid Time: 06-16-2008 08:02
 
send private message
Shortlist
Decline Bid
gunja  
Moscow, RU
location
US$40
bid amount

8.89/108.89/108.89/108.89/108.89/108.89/108.89/108.89/108.89/108.89/10
(36 reviews)

feedback
2 day(s)
delivery time

 
 
Hello. I can do this easily in quite short time.
Bid Time: 06-16-2008 10:06
 
send private message
Shortlist
Decline Bid
developer4mdhaka  
dhaka, BD
location
US$35
bid amount

9.68/109.68/109.68/109.68/109.68/109.68/109.68/109.68/109.68/109.68/10
(22 reviews)

feedback
2 day(s)
delivery time

 
 
please see the pm
Bid Time: 06-16-2008 08:39
 
send private message
Shortlist
Decline Bid
modosansreves  
Kiev, UA
location
US$40
bid amount

9.14/109.14/109.14/109.14/109.14/109.14/109.14/109.14/109.14/109.14/10
(14 reviews)

feedback
1 day(s)
delivery time

 
 
Good morning. I know the concept very good. I have a strong background in C++. I offer good, commented code. With kind regards, Bohdan.
Bid Time: 06-16-2008 18:15
 
send private message
Shortlist
Decline Bid
zerOneIT  
Shenyang, CN
location
US$50
bid amount

9.27/109.27/109.27/109.27/109.27/109.27/109.27/109.27/109.27/109.27/10
(11 reviews)

feedback
2 day(s)
delivery time

 
 
Please Check your PMB.
Bid Time: 06-16-2008 07:53
 
send private message
Shortlist
Decline Bid
samiron  
Dhaka, BD
location
US$41
bid amount

10.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/10
(3 reviews)

feedback
3 day(s)
delivery time

 
 
hi i am interested to do this project. pls check the pm
Bid Time: 06-16-2008 07:43
 
send private message
 
vanzolo  
Beijing, CN
location
US$30
bid amount

10.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/10
(2 reviews)

feedback
1 day(s)
delivery time

 
 
I have been working with C++ for several years and this is an easy case for me. It can be done in one day.
Bid Time: 06-16-2008 05:05
 
send private message
Shortlist
Decline Bid
ccoder4u  
DElhi, IN
location
US$21
bid amount

(No Feedback Yet)
feedback
3 day(s)
delivery time

 
 
i hav done similar project before for different users on GetACoder.
Bid Time: 06-16-2008 05:41
 
send private message
Shortlist
Decline Bid
tanimcsekuet  
KHULNA, BD
location
US$40
bid amount

(No Feedback Yet)
feedback
20 day(s)
delivery time

 
 
HELLO,I'M A CSE Graduate.I'm working in C/C++ in a private firm.I've already made three customize software.I can make this software without bug.I"ll contact with u every two days.So,I think i will get this work.
Bid Time: 06-16-2008 07:39
 
send private message
Shortlist
Decline Bid
piyushsharma7331  
Dehradun, IN
location
US$20
bid amount

(No Feedback Yet)
feedback
2 day(s)
delivery time

 
 
dear sir, I have been working with c & C++ for last two years and this is an easy case for me. i am waiting for your positive reply. Best Regards piyush
Bid Time: 06-16-2008 09:13
 
send private message
Shortlist
Decline Bid
fullworld  
dhaka, BD
location
US$50
bid amount

(No Feedback Yet)
feedback
5 day(s)
delivery time

 
 
check the pm please
Bid Time: 06-16-2008 12:36
 
 


 
Get the Free Step-by-Step Guide on How to Use GetACoder
The act of outsourcing jobs has become easy in the past few years thanks to GetACoder. However, our team aims at making the whole process even easier. So, it has now come the time to provide you with a step-by-step guidance on how to use this service and succeed in the outsourcing world totally for FREE.

It doesn't matter if you are a more experienced user or a novice; using GetACoder will become even simpler with the help of this E-book. There are two major sections: a Buyers section and a Coders section.

Buyers will learn:
  • How to outsource safely
  • How to pick the best freelancers
  • How to manage time and money

Coders will learn:

  • How to get the best jobs
  • How to secure their payments
  • How to build a long-lasting relationship with buyers

    ...and MUCH MORE
Clear examples and pictures illustrating key situations, great tips and real testimonies of some of our best users... all in this Outsourcing Guide.  So don't loose the outstanding opportunity to download GetACoder FREE E-book.
The Outsourcing Revolution: Why It Makes Sense and How to Do It Right
The Outsourcing Revolution: Why It Makes Sense and How to Do It Right
What is GetACoder?

GetACoder.comGetACoder is a leading Global Services Marketplace doing business in more than 200 countries. Our unique system accelerates your time to market and provides your business with key competitive advantages. When you use GetACoder you are stretching your budget and saving as much as 60% over traditional outsourcing. GetACoder is changing business, now it's no longer about what you own or build but which resources and talent you can access. With GetACoder you reduce expenses, increase efficiencies, aggressively grow your business, and create a sustainable competitive advantage. GetACoder makes outsourcing to any part of the world an easy task! With GetACoder it's simple to outsource any business request, gain access to global talent and manage jobs online.

One of the main advantages of GetACoder is the low labor cost. The typically rates are about seven times lower than the ones in the US or Europe. Posting a request at GetACoder allows the right professional or company to find you and to bid for your work. We are building a reputation for exceeding our customers' expectations and for becoming an extremely cost effective way to outsource work. Use GetACoder when you want to save money, increase efficiency or accelerate the development of your request. With GetACoder you focus on growing your business and let others do the tedious work. Post your request on GetACoder for free. Find out why people outsource jobs with us day after day.

Thousands of Satisfied Customers - Submit/View Quotes


-Being quick and professional is a very distinguishing GetACoder's feature that has impressed me so far. - saba
-GetACoder is the best site for earning money. - Tusohian
-GetACoder provides a great service to the humanity by providing self employment. - gsangia
Report Violation    Privacy Policy     Affiliate Program    Terms of Use    Contact Us    Help      GetACoder.com on Facebook      Follow GetACoder on Twitter      GetACoder.com Latest Requests RSS Feed
© 2004-2012 GetACoder. All rights reserved.