Question
Using C#, modify from previous homework to add two radio button so we can choose either Bar Chart or Pie Chart. Also add a combo
Using C#, modify from previous homework to add two radio button so we can choose either Bar Chart or Pie Chart. Also add a combo box with Monday, Tuesday, Wednesday, Thursday, and Friday. Add a textbox so you can add amount of sales on a particular day. When you click change, the corresponding elemeent of the array sales will be changed and bar or pie chart will change accordingly. You should still use an array sales to hold sales for each weekday.
You will get 2 point bonus if you display a percentage for each weekday.
This is what I currently have:
using System.Drawing; using System.Windows.Forms; public class DrawBars : Form { private int[] sales = { 40000, 20000, 35000, 20000, 10000 }; private Brush[] colors = { Brushes.Blue, Brushes.Red, Brushes.Yellow, Brushes.Green, Brushes.Gold }; private Font arialBold24 = new Font("Arial", 24, FontStyle.Bold); private string [] weekday = { "MON", "TUES", "WED", "THUR", "FRI" }; public DrawBars() { Size = new Size(500,500); Text = "Draw and Fill"; BackColor = Color.White; } protected override void OnPaint(PaintEventArgs e){ Graphics g = e.Graphics; displayBars(g);
base.OnPaint(e); } private void displayBars(Graphics g) { int startX=50; int startY=100;
int gap=20; int height=(int)g.MeasureString ("MON", arialBold24).Height; int w = (int)g.MeasureString ("TUES", arialBold24).Width; for(int i=0;i startY=startY+gap+height; } } public static void Main() { Application.Run( new DrawBars() ); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started