Problem Number 8:
My work so far:
Code:import jpb.*; import java.awt.*; import java.util.*; public class StockChart { public static void main(String[] args) { int width = 0; int height = 0; String StockName; String m, t, w, r, f, w1, h; double mon, tues, wed, thur, fri; SimpleIO.prompt("Enter the name of the stock:"); StockName = SimpleIO.readLine(); SimpleIO.prompt("Enter stock price on Monday:"); m = SimpleIO.readLine(); SimpleIO.prompt("Enter stock price on Tuesday:"); t = SimpleIO.readLine(); SimpleIO.prompt("Enter stock price on Wednesday:"); w = SimpleIO.readLine(); SimpleIO.prompt("Enter stock price on Thursday:"); r = SimpleIO.readLine(); SimpleIO.prompt("Enter stock price on Friday:"); f = SimpleIO.readLine(); SimpleIO.prompt("Enter width of chart:"); w1 = SimpleIO.readLine(); width = Integer.parseInt(w1); SimpleIO.prompt("Enter height of chart:"); h = SimpleIO.readLine(); height = Integer.parseInt(h); DrawableFrame df = new DrawableFrame("Chart for " + StockName); df.show(); df.setSize(width, height); Graphics g = df.getGraphicsContext(); { g.setColor(Color.red); g.fillRect(0, (height/2), (width/5), (height/2)); g.setColor(Color.blue); g.fillRect(0, (height/2), (width/5), (height/2)); g.setColor(Color.green); g.fillRect(0, (height/2), (width/5), (height/2)); g.setColor(Color.magenta); g.fillRect(0, (height/2), (width/5), (height/2)); g.setColor(Color.cyan); g.fillRect(0, (height/2), (width/5), (height/2)); } } }
Please Help.....From this point we don't know what to do and he never went over this![]()
![]()
![]()





Reply With Quote
Bookmarks