Hi.. Can anyone please help me to write the following program:

Write a program that will calculate the price to be paid for the development of photographs. The program must use
two overloaded functions, each named calcTotal. If the client wants jumbo photographs, and the film is a 36
exposure film, the client gets 5% discount. If the client wants normal size photographs, and the film is a 36 exposure
film, he may discard up to 6 photographs without having to pay for it. The first function must calculate the total to be
paid for jumbo photographs, and will have one parameter of type int representing the exposure. The second
function will have two parameters of type int representing the exposure and the number of photographs to be
discarded. The functions must decide whether a discount (in the case of the jumbo photographs) or discarding of
photographs (in the case of normal size photographs) is allowed when calculating the total price. The user must
specify whether he wants jumbo size or normal size and the main program must then ask for the number of
photographs to be discarded if applicable. Both functions must return the total to be paid by the client in a variable of
type double. The main function should the display the total price. Define const variables where applicable inside
the function for the price of each photo – R3.40 for a jumbo and R3.20 for a normal size photo, as well as a const
variable for the discount value.
Hoping to be able to solve it by ur help..thank you in advance

7 Years
Discussion Span
Last Post by shahanakazi

We don't just solve assigments here! You start it, get some code going, and post specific problems with the code you have. We have to see that you have been making a real effort to solve this problem by yourself. We only give help to cross the few hurdles you meet along your way, we don't just drive you all the way.

BTW: don't post such general titles as "C++ program", try to be more specific about it like "Writing a Photo Store Management Program"


Here is what i've written so far but i know there's plenty of mistakes in the program as it is not working correctly also.

Hoping to get some help..as i am not really good at doing programming..its only a part of the module i am studying at university.

//calculates the price to be paid for the development of photographs
#include <iostream>

double calcTotal(int exposure)
    const double PRICE = 3.40;
    const double DISCOUNT = 0.05;
    double discount, priceBeforeDiscount;
    priceBeforeDiscount = exposure * PRICE;
    discount = priceBeforeDiscount * DISCOUNT;
    return(priceBeforeDiscount - discount);

double calcTotal(int exposure, int number_discarded)
    const double PRICE = 3.20;
    const int FREE_PHOTO = 6;
    int numPhoto;
    numPhoto = number_discarded - FREE_PHOTO; 
    return (numPhoto * PRICE);

int main ()
    using namespace std;
    int exposure = 36;
    int number_discarded;
    double total_price;
    char answer;

    cout << "Do you want jumbo-size photograpths. or normal-size photographs?"
         << "(Enter 'J' for jumbo-size photograph and 'N' for normal size photograph)";
    cin >> answer;

    if (answer == 'J')
        total_price = calcTotal(exposure);
        cout << "Enter the number of photographs to be discarded: ";
        cin >> number_discarded;
        total_price = calcTotal(exposure,number_discarded);

    cout << "The total price to be paid for the development of photographs is R" << total_price << endl;
    return 0;

Edited by Nick Evan: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.