Starting from:

$25

CSE271 Lab 10- Solved

For this week’s lab, you will be doing two exercises pertaining to Layouts and Menus GUIs.  A reminder that we do not have a physical lab this week, but you will have more time as a result.

Now that you know layouts, you must make the GUIs 

1)         Functional

2)         Logically and aesthetically laid out 

Use the various layout managers and all the things we have learned in class this past week to accomplish 2). 

Updated TA Office Hours
You are welcome to go to office hours for TAs from any section!

•       Dustin Riley, rileydm3@miamioh.edu  , Tuesday 730-830pm Benton 002

•       Emily Pantuso, pantusen@miamioh.edu  , Monday 700-800pm Benton 002

•       Gage Laufenberg, laufengd@miamioh.edu  , Monday 9-10pm Benton 002

•       Michael Gentile, gentilm5@miamioh.edu  , Tuesday 830-930 Benton 006

•       Brendan Nofs, nofsbm@miamioh.edu , Sunday 6-7PM , Benton 006

•       Rob Koch, kochrt@miamioh.edu , Sunday 7-8pm, Benton 006

•       Thomas Burlett, burlette@miamioh.edu , Sunday 8-9pm, Benton 006

•       Sarah Edmonds, edmondsh@miamioh.edu , Sunday 9-10pm, Benton 006

Part 1 (15 points)
Write a program with a graphical interface that allows the user to convert an amount of money between U.S. dollars (USD), euros (EUR), and British pounds (GBP). You can model your GUI after online examples like Google's CC , XE's CC, or other examples. 

The user interface must have the following elements (10 points, which includes the functionality and aesthetics):   

•      A text field to enter the amount to be converted  o You do not need to error check. That is, you should just ignore all non-doubles, and process doubles only.

•      Two combo boxes to allow the user to select the currencies

•      A button to make the conversion

•      A label to show the result  o Please ensure your doubles are all formatted correctly when outputting them to the panel.  Some helpful links on how to do this (cite your work!) include: 

§  https://docs.oracle.com/javase/7/docs/api/java/text/D ecimalFormat.html

§  https://www.mkyong.com/java/java-display-doublein-2-decimal-points/   

 

Display a warning in either a label or a dialog box (link here)  if the user does not choose different currencies.  Clear this warning after a successful conversation/currency switch.  You can check if they are similar on the conversion button press or on the initial selection of the same currencies.  (5 points)  Use the following conversion rates:

1 EUR is equal to 1.42 USD.

1 GBP is equal to 1.64 USD. 

1 GBP is equal to 1.13 EUR.

Tips

•      You can call a very helpful method called pack() on the frame and it will automatically set the desired width and height of the frame.  https://docs.oracle.com/javase/7/docs/api/java/awt/Window.ht ml#pack()

                 

Part 2 (15 points)
 

Write an application with a Colour menu, and three menu items labeled “Red”, “Green”, and “Blue” that change the background colour of a Panel in the center of the frame to Red, Green, or Blue, respectively. That is, the panel (colour) envelopes the entire frame.

(5 points)

•      Check the Swing API on your own to learn how to change the background colour of a Panel. 

•      For full points (and best way of doing it), use a LOCAL INNER Class like we did in lecture

 

In addition, if the user mouse clicks anywhere in your Panel, have the background colour change/rotate to the next colour in the order of Red, Green, Blue. So, start your panel off as Red.  If they click your panel while it is Red, it turns Green. Green goes to Blue. Blue goes to Red.  (10 points) 

 



 

Turn in a “.zip” of your “src” files to Canvas by the deadline, organized in your appropriate Java package. Ensure you have actually submitted (received confirmation and checked online), since no late labs will be accepted. 

More products