Question

In: Computer Science

Please complete in C# and use radio buttons on the form for the selections. Thank you!...

Please complete in C# and use radio buttons on the form for the selections. Thank you!

For this assignment, you will be creating a Dorm and Meal Plan Calculator.

A university has the following dormitories: Allen Hall $1,500 per semester Pike Hall $1,600 per semester Farthing Hall $1,800 per semester University Suites $2,500 per semester The university also offers the following meal plans: 7 meals per week $ 600 per semester 14 meals per week $1,200 per semester Unlimited meals $1,700 per semester Create a multi-form Windows Forms Application with two forms.

The main form should allow the user to select a dormitory and a meal plan. The application should show the total charges on the second form.

Solutions

Expert Solution

Solution:

Form1.cs

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 WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        //store the dorm and meal fees in array to calculate
        int[] dormFees = { 1500, 1600, 1800, 2500 };
        int[] mealFees = { 600, 1200, 1700 };
        public Form1()
        {

            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //set the initial index of the combo boxes to 0 when form first loads
            comboBox1.SelectedIndex = 0;
            comboBox2.SelectedIndex = 0;
        }
      
        //when calculate button is clicked this event is called
        private void button1_Click(object sender, EventArgs e)
        {
            //selects the choice from the comboboxes and adds the total using fees arrays declared before
            int totalFees = dormFees[comboBox1.SelectedIndex] + mealFees[comboBox2.SelectedIndex];
            Form2 f2 = new Form2(totalFees); //initilise a new form2 class to display the total
            f2.Show();
        }
    }

}

Form1(design):

Form2.cs:

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 WindowsFormsApplication1
{
    public partial class Form2 : Form
    {
        int totalFees;
        public Form2(int totalFees)
        {
            this.totalFees = totalFees;
            InitializeComponent();
            label1.Text = totalFees.ToString("C"); //displays the total in a label with currency
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close(); //closes form2
        }
    }
}

Form2(design):

Output:


Related Solutions

Using C#: Create a Form that consists of a PictureBox and 3 radio buttons. Assign an...
Using C#: Create a Form that consists of a PictureBox and 3 radio buttons. Assign an image of your choice to the PictureBox. Each radio button should be associated with a specific PictureBox size mode. When the user clicks on a specific radio button, the PictureBox's size mode should be changed to reflect the selection.
Using C#: Create a Form that consists of 4 checkboxes, three radio buttons, a label and...
Using C#: Create a Form that consists of 4 checkboxes, three radio buttons, a label and a button. The 4 checkboxes represent pizza toppings. The three radiobuttons should represent three sizes of pizza, namely “small”, “medium” and “large”. When the user clicks the button you need to calculate the price of the pizza. The calculation should be done as follows: count up the cost of the selected ingredients (you may assign your own prices for the ingredients) and then multiply...
Please solve A, B, and C. Please use excel. Please show work. Thank you. A. Use...
Please solve A, B, and C. Please use excel. Please show work. Thank you. A. Use the stocks of Apple, SAP, IBM, Oracle, and Amazon Download the historical data of weekly stock prices and S&P 500 index prices from year 2017-2019 on the website of yahoo finance and save it on an excel file. B. Use a different sheet to save the market adjusted prices of Apple, SAP, IBM, Oracle, and Amazon t and the index. For each stock, compute...
Please only answer if you're 100% on the answer and can fully complete. Thank you. USE...
Please only answer if you're 100% on the answer and can fully complete. Thank you. USE FIRST-IN, FIRST-OUT COSTING Sulu Company produces its finished product in two processing departments--Assembly and Packaging. The following information is available for the month of July: Assembly Department: The beginning work-in-process inventory was $5,755 ($4,815 direct materials and $940 conversion costs) and consisted of 350 units that were 10% complete as to conversion costs. During July, an additional 4,500 units were started into production. A...
Please complete just Form 1040 (you do not need to fill out a Schedule C or...
Please complete just Form 1040 (you do not need to fill out a Schedule C or Schedule D, but you can use them to calculate numbers to enter into Form 1040) for a client with the following tax situation: Paul Gigornovich Address: 123 HillCrest Lane, San Diego, CA 92101 Wage income: $45,000/00 W2 Federal Tax Withholdings: $4,000.00 Net Long Term Stock Sales Gain: $8,000.00 Net Short Term Sock Sale Loss: -$12,000.00 Sole Proprietorship Business Gross Income: $80,000.00 Expenses: Interest: $8,000.00...
In C++ Please comment in all-new lines of code, thank you DO NOT USE ANSWERS THAT...
In C++ Please comment in all-new lines of code, thank you DO NOT USE ANSWERS THAT ALREADY BEEN POSTED, please use code from the assignment Copy-paste will be reported Write a program to compare those two searching algorithms and also compare two sorting algorithms. You need to modify those codes in the book/slides to have some counters to count the number of comparisons and number of swaps. In the main function, you should have an ordered array of 120 integers...
Please answer in paragraph form and this question is in term of Marketing. Thank you!! Why...
Please answer in paragraph form and this question is in term of Marketing. Thank you!! Why would a celebrity want to be careful about endorsing brands that might be controversial? In other words what happens when a celebrity you like endorses a product that you do not like?
How LUNCH meterpreter in Kali Linux. Complete command please. Thank you
How LUNCH meterpreter in Kali Linux. Complete command please. Thank you
Also please add comments on the code and complete in C and also please use your...
Also please add comments on the code and complete in C and also please use your last name as key. The primary objective of this project is to increase your understanding of the fundamental implementation of Vigenere Cipher based program to encrypt any given message based on the Vignere algorithm. Your last name must be used as the cipher key. You also have to skip the space between the words, while replicating the key to cover the entire message. Test...
** Please use only Rstudio and include code ** The target activation force of the buttons...
** Please use only Rstudio and include code ** The target activation force of the buttons on a clicker is 1.967 newtons. Variation exists in activation force due to the nature of the manufacturing process. A sample of 9 clickers showed a mean activation force of 1.88 newtons. The population standard deviation is known to be 0.145 newton. Too much force makes the keys hard to click, while too little force means the keys might be clicked accidentally. We want...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT