| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 626 人关注过本帖
标题:请问下我这个程序要怎么修改才可以增加一个计算的过程。初学者。希望哪位好 ...
只看楼主 加入收藏
kofvi
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2011-8-5
结帖率:100%
收藏
 问题点数:0 回复次数:7 
请问下我这个程序要怎么修改才可以增加一个计算的过程。初学者。希望哪位好心人能帮忙修改详细点
using System;

namespace practicalTest2
{
    class Program
    {
        static void Main(string[] args)
        {
            // Declare and initialise constants
            const int MIN_YEAR = 1900;
            const int MAX_YEAR = 2011;
            
            // RATING constants
            const int MIN_RATING = 0;
            const int MAX_RATING = 5;

            const float ACTING_PERCENTAGE = 0.25F;
            const float MUSIC_PERCENTAGE = 0.15F;
            const float CINEMATOGRAPHY_PERCENTAGE = 0.20F;
            const float PLOT_PERCENTAGE = 0.30F;
            const float DURATION_PERCENTAGE = 0.10F;

            // Declare and initialise variables
            
            // Movie variables
            string movie_title = "";
            int year_released = MIN_YEAR;
            string publisher = "";
            float length = 0.0F;

            // Rating variables
            int acting_rating = MIN_RATING;
            int music_rating = MIN_RATING;
            int cinematography_rating = MIN_RATING;
            int plot_rating = MIN_RATING;
            int duration_rating = MIN_RATING;

            // Set test values to variables
            movie_title = "Singing Bone";
            year_released = 2010;
            publisher = "Timberlake Productions";
            length = 3.5F;

            // Rating variables
            acting_rating = 4;
            music_rating = 3;
            cinematography_rating = 4;
            plot_rating = 3;
            duration_rating = 2;

            // Output the movie data
            Console.WriteLine("Movie Information");
            Console.WriteLine("Movie Title : {0}", movie_title);
            Console.WriteLine("Year released : {0}", year_released);
            Console.WriteLine("Publisher  : {0}", publisher);
            Console.WriteLine("Length (hrs) : {0}", length.ToString("F1"));
            Console.WriteLine("Ratings");
            Console.WriteLine("Acting : {0}", acting_rating);
            Console.WriteLine("Music : {0}", music_rating);
            Console.WriteLine("Cinematography : {0}", cinematography_rating);
            Console.WriteLine("Plot : {0}", plot_rating);
            Console.WriteLine("Duration : {0}", duration_rating);
        }
    }
}


计算的公式是
Movie Title
Year released
Publisher
Length (hrs)
Rate the acting (out of 5)
Rate the music (out of 5)
Rate the cinematography (out of 5)
Rate the plot (out of 5)
Rate the duration (out of 5)
Calculate the movie rating using the following:

Rate the acting (out of 5) : 25% of overall rating
Rate the music (out of 5) : 15% of overall rating
Rate the cinematography (out of 5) : 20% of overall rating
Rate the plot (out of 5) : 30% of overall rating
Rate the duration (out of 5) : 10% of overall rating

最后还要体现出输出的结果
Movie Information
Movie Title : Singing Bone
Year released : 2010
Publisher : Timberlake Productions
Length (hrs) : 3.5
Ratings
Acting : 4
Music : 3
Cinematography : 4
Plot : 3
Duration : 2

Overall rating is  7/10 : *******

搜索更多相关主题的帖子: 2011 class 
2011-08-09 14:54
福利费
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:109
专家分:197
注 册:2010-9-26
收藏
得分:0 
你这是c#语言怎么放汇编这里来了
2011-08-09 16:08
kofvi
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2011-8-5
收藏
得分:0 
这个不是c#语言区么????
2011-08-09 20:21
一氧化碳
Rank: 5Rank: 5
等 级:职业侠客
威 望:1
帖 子:132
专家分:335
注 册:2007-8-13
收藏
得分:0 
回复 楼主 kofvi
老大看清楚再说。

2011-08-10 16:31
guang
Rank: 4
来 自:广东深圳
等 级:贵宾
威 望:13
帖 子:1414
专家分:285
注 册:2006-4-3
收藏
得分:0 
是被移动过来的帖子

不相信未作牺牲竟先可拥有,只相信靠双手找到我的欲求!!
我的博客:http://liao5930.blog.
2011-08-10 16:58
kofvi
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2011-8-5
收藏
得分:0 
为什么主要的问题没被讨论。。。。。
2011-08-10 17:34
tianqy
Rank: 5Rank: 5
等 级:职业侠客
帖 子:260
专家分:332
注 册:2011-4-7
收藏
得分:0 
这到底是什么?我被你们搞糊涂了

☞  软件驱动整个世界 ☜
2011-08-16 17:38
xydddaxia
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:33
帖 子:466
专家分:2307
注 册:2009-3-20
收藏
得分:0 
程序代码:
   const float ACTING_PERCENTAGE = 0.25F;
        const float MUSIC_PERCENTAGE = 0.15F;
        const float CINEMATOGRAPHY_PERCENTAGE = 0.20F;
        const float PLOT_PERCENTAGE = 0.30F;
        const float DURATION_PERCENTAGE = 0.10F;
        /// <summary>
        /// 计算过程
        /// </summary>
        /// <param name="acting"></param>
        /// <param name="music"></param>
        /// <param name="cinematography"></param>
        /// <param name="plot"></param>
        /// <param name="duration"></param>
        private void CalculateMovie(int acting, int music, int cinematography, int plot, int duration)
        {
            int all = acting + music + cinematography + cinematography + duration;
            double result=0;
            result = result * ACTING_PERCENTAGE + result * MUSIC_PERCENTAGE + result * CINEMATOGRAPHY_PERCENTAGE + result * PLOT_PERCENTAGE + result * DURATION_PERCENTAGE;
            Console.WriteLine("Overall rating is " + result.ToString()); 
        }

站在春哥的肩膀上
2011-08-16 18:00
快速回复:请问下我这个程序要怎么修改才可以增加一个计算的过程。初学者。希望哪 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017813 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved