who can help me, how to progame it???

yying227 2005-08-24 09:37:30
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
}
}
...全文
58 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
yying227 2005-08-24
  • 打赏
  • 举报
回复
我的qq 153111030,我是小鸟...大家帮帮忙

110,535

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧