Answer to Question #259997 in C# for Saleem

Question #259997

A library charges a fine for every book returned late. For first 5 days the fine is 50 Rs, for 6-10 days fine is 100 rupee and above 10 days fine is 150 rupees. If you return the book after 30 days your membership will be cancelled. Write a program C# to accept the number of days the member is late to return the book and display the fine or the appropriate message.


1
Expert's answer
2021-11-02T08:22:41-0400
#include <iostream>


using namespace std;


int main()
{
    cout << "Enter number of days: ";
    int days;
    cin >> days;


    cout << endl;


    double fine;
    string membership = "";


    if(days <= 5)
        fine = 50;
    else if(days > 5 && days <= 10)
        fine = 100;
    else
    {
        fine = 150;
        if(days > 30)
            membership = "Your membership was cancelled.";
    }


    cout << "Fine: " << fine << " rupees" << endl;
    cout << membership << endl;




    cout << endl << endl;


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS