Answer to Question #298688 in C# for skillie

Question #298688

How to create a shop that shows the following:

Name:

Surname:

Quantity: ( using a drop down list)


Create check boxes for Volvo BMW and Merc


Payment using radio buttons for Cash Of loan


Comments for users to put in


when the user press the BUY button it must show an message box that says thanks you with the user name and the car they pick that shows the also the car total balance and if they pick 2 cars cars it must show the car 1 + car 2 = total and if the pick 2 volvo it much show the total of the 2 cars and then it much also print the Payment the choose loan or cash and it much also show the comments in the message box


1
Expert's answer
2022-02-16T14:55:03-0500



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


namespace CarShop
{
    public partial class frmCarShop : Form
    {
        public frmCarShop()
        {
            InitializeComponent();


            for (int i = 1; i <=100; i++) {
                cbQuantity.Items.Add(i.ToString());
            }
        }


        private void btnBUY_Click(object sender, EventArgs e)
        {
            string info = "Thanks,"+txtName.Text+" "+txtSurname.Text+Environment.NewLine;
            info += "Selected car: " + Environment.NewLine;
            double total = 0;
            if (cbVolvo.Checked) {
                info += "Volvo" + Environment.NewLine;
                total += int.Parse(cbQuantity.SelectedItem.ToString());
            }
            if (cbBMW.Checked)
            {
                info += "BMW" + Environment.NewLine;
                total += int.Parse(cbQuantity.SelectedItem.ToString());
            }
            if (cbMerc.Checked)
            {
                info += "Merc" + Environment.NewLine;
                total += int.Parse(cbQuantity.SelectedItem.ToString());
            }
            info += "Total cars: " + total.ToString() + Environment.NewLine;
            if (rbCash.Checked)
            {
                info += "Payment: " + rbCash.Text + Environment.NewLine;
            }
            else {
                info += "Payment: " + rbLoan.Text + Environment.NewLine;
            }
            
            
            info += "Comments: " + txtComments.Text + Environment.NewLine;


            MessageBox.Show(info);
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS