Question

1. Create a C# app for the Hollywood Movie Rating Guide, which can be installed in...

1. Create a C# app for the Hollywood Movie Rating Guide, which can be installed in a kiosk in theaters. Each theater patron enters a value from zero to for indicating the number of stars that the patron awards to the guide’s featured movie of the week. If a user enters a star value that does not fall in the correct range, prompt the user continuously until a correct value is entered. The program executes continuously until the theater manager enters a negative number to quit. At the end of the app, display the average star rating for the movie.

2. Modify the movie-rating program so that a user gets three tries to enter a valid rating. After three incorrect tries entries, the program issues an appropriate message and continues with a new user.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Design

Form1.Designer.cs

namespace HollywoodMovie
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.label1 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.btnrating = new System.Windows.Forms.Button();
            this.label2 = new System.Windows.Forms.Label();
            this.txtrating = new System.Windows.Forms.TextBox();
            this.lblavg = new System.Windows.Forms.Label();
            this.SuspendLayout();
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("Modern No. 20", 16.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label1.Location = new System.Drawing.Point(270, 44);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(401, 30);
            this.label1.TabIndex = 0;
            this.label1.Text = "Hollywood Movie Rating Guide";
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(345, 168);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(232, 17);
            this.label3.TabIndex = 3;
            this.label3.Text = "Please Enter Rating Between 0 to 5";
            //
            // btnrating
            //
            this.btnrating.Location = new System.Drawing.Point(536, 108);
            this.btnrating.Name = "btnrating";
            this.btnrating.Size = new System.Drawing.Size(94, 37);
            this.btnrating.TabIndex = 4;
            this.btnrating.Text = "Rating";
            this.btnrating.UseVisualStyleBackColor = true;
            this.btnrating.Click += new System.EventHandler(this.btnrating_Click);
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(272, 118);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(53, 17);
            this.label2.TabIndex = 1;
            this.label2.Text = "Rating:";
            //
            // txtrating
            //
            this.txtrating.Location = new System.Drawing.Point(348, 118);
            this.txtrating.Name = "txtrating";
            this.txtrating.Size = new System.Drawing.Size(145, 22);
            this.txtrating.TabIndex = 5;
            //
            // lblavg
            //
            this.lblavg.AutoSize = true;
            this.lblavg.Location = new System.Drawing.Point(360, 234);
            this.lblavg.Name = "lblavg";
            this.lblavg.Size = new System.Drawing.Size(46, 17);
            this.lblavg.TabIndex = 6;
            this.lblavg.Text = "label4";
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(1015, 463);
            this.Controls.Add(this.lblavg);
            this.Controls.Add(this.txtrating);
            this.Controls.Add(this.btnrating);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Name = "Form1";
            this.Text = "Form1";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Button btnrating;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.TextBox txtrating;
        private System.Windows.Forms.Label lblavg;
    }
}

Coding

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace HollywoodMovie
{
    public partial class Form1 : Form
    {
        double rating,total=0,count=0,error_count=0;
        double avg;
        public Form1()
        {
            InitializeComponent();
        }

        private void btnrating_Click(object sender, EventArgs e)
        {
            rating = Convert.ToDouble(txtrating.Text);//here rating value in variable
            if (rating > 0 && rating <= 5)//check if it is between 0 to 5
            {
                total += rating;//total calculate
                count++;//count increment
                txtrating.Text = "";//here is textbox blank
            }
            else if (rating < 0)//if value is negative then manager then average display
            {
                avg = total / count;
                lblavg.Text = "Average is here ="+Convert.ToString(avg);//display here
                txtrating.Text = "";//here is textbox blank
            }
            else
            {
                error_count++;
                if (error_count == 3)//check if three time
                {
                MessageBox.Show("Continues with a new user");//message for new message here
                error_count = 0;
                }
                txtrating.Text = "";//here is textbox blank
            }
          }

        private void Form1_Load(object sender, EventArgs e)
        {
            lblavg.Text = "";//null value in load time
        }
    }
}

output:

if you still have any Problem regarding this question please comment and if you like my code please appreciate me by thumbs up thank you.........

Add a comment
Know the answer?
Add Answer to:
1. Create a C# app for the Hollywood Movie Rating Guide, which can be installed in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Practice C# Activity The purpose of this activity is to allow students to become accustomed to...

    Practice C# Activity The purpose of this activity is to allow students to become accustomed to the Visual Studio IDE and the differences in C# and Java. In this app, you will get practice working with C# I/O, if statements and loops. 1. Create a C# app for the Hollywood Movie Rating Guide, which can be installed in a kiosk in theaters. Each theater patron enters a value from zero to four indicating the number of stars that the patron...

  • Java program. Mike's Movie Theater is a local cinema showing the latest Hollywood hits. Create a...

    Java program. Mike's Movie Theater is a local cinema showing the latest Hollywood hits. Create a class called Movie that stores basic information about a single movie: the title, the running time or length of the film (in minutes), the showtimes (as a single string, such as "11:00,3:15,7:30"), and the film's rating (R, PG-13, PG, or G). Include get and set methods for each; the setter for rating should check that the value is one of the four valid options...

  • In C Program This program will store the roster and rating information for a soccer team. There w...

    In C Program This program will store the roster and rating information for a soccer team. There will be 3 pieces of information about each player: Name: string, 1-100 characters (nickname or first name only, NO SPACES) Jersey Number: integer, 1-99 (these must be unique) Rating: double, 0.0-100.0 You must create a struct called "playData" to hold all the information defined above for a single player. You must use an array of your structs to to store this information. You...

  • Case Program 10 – 1: Part 1: Previously, you created a Contestant class for the Greenville Idol c...

    Case Program 10 – 1: Part 1: Previously, you created a Contestant class for the Greenville Idol competition. The class includes a contestant’s name, talent code, and talent description. The competition has become so popular that separate contests with differing entry fees have been established for children, teenagers, and adults. Modify the Contestant class to contain a field Fee that holds the entry fee for each category, and add get and set accessors. Extend the Contestant class to create three...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT