A good answer might be:

GUI Components of the Program

The complete application (when we finish with it) is 80 lines long. All this to implement a one-line formula! For short applications, this is typical. But for longer applications the percentage of code for the GUI part is about 40%.

Let us build the interface part of the program. Look at the GUI on the right to determine what should go into the program. Click the buttons to see if you are correct.




import 
import 
import javax.swing.*;

public class percentFat extends JFrame implements 
{
  JLabel title      = new JLabel(" ");
  JLabel fatLabel   = new JLabel(" ");
  JLabel calLabel   = new JLabel(" ");
  JLabel perLabel   = new JLabel(" ");

  JTextField inFat  = new JTextField( 7 );
  JTextField inCal  = new JTextField( 7 );
  JTextField outPer = new JTextField( 7 );

doit     = new JButton("Do It!");

  int calories ;    // input: total calories per serving
  int fatGrams ;    // input: grams of fat per serving
  double percent ;  // result: percent
    
  public percentFat()  
  {  
    . . . . . . // components will be added 
    . . . . . . // to the frame here
  }



QUESTION 12:

In a professional-level software product, who do you think designs the "look" of the GUI? Programmers? Artists? Industrial designers?