who can help me, how to progame it???
We wish to develop a program to determine the cost of a video/DVD rental. There are several rules that determine
the cost.
- a new release is $5 per day, a recent release is $3 per day and an old release is $1 per day. For old releases
the second and subsequent days cost only $0.50 per day.
- if the person renting is a student a 20% discount is given.
- the minimum rental cost is $1.
- the maximum rental period is seven days.
- a further 50% discount is applied to rentals that commence on Monday or Tuesday and are for 3 days or
less.
Take care to implement this program in stages. Implement, test and get working each rule one at a time. Start with a
program that collects needed information from the user and applies a $5 a day rule. Then extend this program one
rule at a time.
using System;
public class Tester
{
public static void Main ()
{
string type; // Expect new, recent, old
string student; // Expect yes/no
string dayOfWeek; // Expect mon,tue,wed,thu,fri,sat,su
string days;
// Collect information needed to determine the video rate
// - type (new, recent, old)
// - number of days
// - student ?
// - current day of the week
// Print the entered details (type, student, dayOfWeek, days)
Console.WriteLine ( ... );
// Calculate the rental
double rate = getVideoRate ( ... );
if (rate > 0)
Console.WriteLine (“Rental cost is: {0}”, rate);
else
Console.WriteLine (“Error: the rental rate could not be calculated”);
}
public static double getVideoRate (...)
{
// Your code
}
}