Here's the pizza example layout.Need Help with this program. Java
PizzaFormFrame.java
import java.awt.event.ItemEvent;
import javax.swing.JFrame;
public class PizzaFormFrame extends JFrame {
private static final double SMALL_PIZZA_PRICE = 10.00;
private static final double MEDIUM_PIZZA_PRICE = 12.00;
private static final double LARGE_PIZZA_PRICE = 15.00;
private static final double ADDONS_PRICE = 0.50;
private static final double SOFT_DRINKS_PRICE = 5.00;
public PizzaFormFrame() {
initComponents();
pizzaPriceField.setText("0.00");
addonsPriceField.setText("0.00");
drinksPriceField.setText("0.00");
totalPriceField.setText("0.00");
}
/**
* This method is called from within the constructor to initialize
the form.
* WARNING: Do NOT modify this code. The content of this method is
always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated
Code">
private void initComponents() {
sizeGroup = new javax.swing.ButtonGroup();
jLabel1 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
smallRB = new javax.swing.JRadioButton();
mediumRB = new javax.swing.JRadioButton();
largeRB = new javax.swing.JRadioButton();
addonsPriceField = new javax.swing.JTextField();
jPanel2 = new javax.swing.JPanel();
pepperoniCB = new javax.swing.JCheckBox();
anchoviesCB = new javax.swing.JCheckBox();
drinksPriceField = new javax.swing.JTextField();
jPanel3 = new javax.swing.JPanel();
drinksComboBox = new javax.swing.JComboBox();
pizzaPriceField = new javax.swing.JTextField();
jPanel4 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
totalPriceField = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
doneButton = new javax.swing.JButton();
jPanel5 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
orderDetailsArea = new javax.swing.JTextArea();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
menu = new javax.swing.JMenu();
newOrderMenu = new javax.swing.JMenuItem();
exitMenu = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); //
NOI18N
jLabel1.setText("Pizza Parlor");
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(140, 10, -1,
-1));
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Size", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12), new java.awt.Color(0, 153, 51))); // NOI18N
sizeGroup.add(smallRB);
smallRB.setFont(new java.awt.Font("Tahoma", 0, 12)); //
NOI18N
smallRB.setText("Small");
smallRB.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt) {
smallRBActionPerformed(evt);
}
});
sizeGroup.add(mediumRB);
mediumRB.setFont(new java.awt.Font("Tahoma", 0, 12)); //
NOI18N
mediumRB.setText("Medium");
mediumRB.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt) {
mediumRBActionPerformed(evt);
}
});
sizeGroup.add(largeRB);
largeRB.setFont(new java.awt.Font("Tahoma", 0, 12)); //
NOI18N
largeRB.setText("Large");
largeRB.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt) {
largeRBActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new
javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(smallRB)
.addComponent(mediumRB)
.addComponent(largeRB))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(smallRB)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(mediumRB)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(largeRB)
.addContainerGap(9, Short.MAX_VALUE))
);
getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));
addonsPriceField.setEditable(false);
addonsPriceField.setFont(new java.awt.Font("Tahoma", 1, 14)); //
NOI18N
getContentPane().add(addonsPriceField, new
org.netbeans.lib.awtextra.AbsoluteConstraints(140, 160, 80,
-1));
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Add-ons", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12), new java.awt.Color(0, 153, 51))); // NOI18N
pepperoniCB.setFont(new java.awt.Font("Tahoma", 0, 12)); //
NOI18N
pepperoniCB.setText("Pepperoni");
pepperoniCB.addItemListener(new java.awt.event.ItemListener()
{
public void itemStateChanged(java.awt.event.ItemEvent evt) {
pepperoniCBItemStateChanged(evt);
}
});
anchoviesCB.setFont(new java.awt.Font("Tahoma", 0, 12)); //
NOI18N
anchoviesCB.setText("Anchovies");
anchoviesCB.addItemListener(new java.awt.event.ItemListener()
{
public void itemStateChanged(java.awt.event.ItemEvent evt) {
anchoviesCBItemStateChanged(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new
javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(pepperoniCB)
.addComponent(anchoviesCB))
.addContainerGap(31, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(pepperoniCB)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
16, Short.MAX_VALUE)
.addComponent(anchoviesCB)
.addContainerGap())
);
getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 50, 130, 100));
drinksPriceField.setEditable(false);
drinksPriceField.setFont(new java.awt.Font("Tahoma", 1, 14)); //
NOI18N
getContentPane().add(drinksPriceField, new
org.netbeans.lib.awtextra.AbsoluteConstraints(280, 160, 60,
-1));
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Soft Drinks", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12), new java.awt.Color(0, 153, 51))); // NOI18N
drinksComboBox.setModel(new javax.swing.DefaultComboBoxModel(new
String[] { "Minute Maid", "Coca-Cola", "Country Time", "Seven Up"
}));
drinksComboBox.addActionListener(new
java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
drinksComboBoxActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new
javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(drinksComboBox, 0, 118, Short.MAX_VALUE)
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(drinksComboBox,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(33, Short.MAX_VALUE))
);
getContentPane().add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 50, 150, 100));
pizzaPriceField.setEditable(false);
pizzaPriceField.setFont(new java.awt.Font("Tahoma", 1, 14)); //
NOI18N
getContentPane().add(pizzaPriceField, new
org.netbeans.lib.awtextra.AbsoluteConstraints(30, 160, 60,
-1));
jPanel4.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 153, 51), 2, true));
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14)); //
NOI18N
jLabel3.setText("Your Price");
totalPriceField.setEditable(false);
totalPriceField.setFont(new java.awt.Font("Tahoma", 0, 12)); //
NOI18N
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14)); //
NOI18N
jLabel2.setText("$");
javax.swing.GroupLayout jPanel4Layout = new
javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel3)
.addGap(18, 18, 18)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(totalPriceField,
javax.swing.GroupLayout.DEFAULT_SIZE, 104, Short.MAX_VALUE)
.addContainerGap())
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel4Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel3))
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(totalPriceField,
javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE)
.addComponent(jLabel2)))
.addContainerGap())
);
getContentPane().add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 210, 220, 50));
doneButton.setFont(new java.awt.Font("Tahoma", 0, 14)); //
NOI18N
doneButton.setText("DONE");
doneButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED,
new java.awt.Color(0, 153, 51), new java.awt.Color(102, 102, 102),
null, new java.awt.Color(204, 204, 204)));
doneButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt) {
doneButtonActionPerformed(evt);
}
});
getContentPane().add(doneButton, new
org.netbeans.lib.awtextra.AbsoluteConstraints(140, 280, 90,
40));
jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 255, 102), 2, true), "Order Details", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14), new java.awt.Color(0, 153, 51))); // NOI18N
orderDetailsArea.setEditable(false);
orderDetailsArea.setColumns(20);
orderDetailsArea.setRows(5);
jScrollPane1.setViewportView(orderDetailsArea);
javax.swing.GroupLayout jPanel5Layout = new
javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE,
358, Short.MAX_VALUE)
.addContainerGap())
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 9, Short.MAX_VALUE))
);
getContentPane().add(jPanel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 340, 390, 130));
jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14)); //
NOI18N
jLabel4.setText("$");
getContentPane().add(jLabel4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(20, 160, -1,
-1));
jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); //
NOI18N
jLabel5.setText("$");
getContentPane().add(jLabel5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(130, 160, -1,
-1));
jLabel6.setFont(new java.awt.Font("Tahoma", 0, 14)); //
NOI18N
jLabel6.setText("$");
getContentPane().add(jLabel6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(270, 160, -1,
-1));
menu.setText("File");
newOrderMenu.setText("New Order");
newOrderMenu.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt) {
newOrderMenuActionPerformed(evt);
}
});
menu.add(newOrderMenu);
exitMenu.setText("Exit");
exitMenu.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt) {
exitMenuActionPerformed(evt);
}
});
menu.add(exitMenu);
jMenuBar1.add(menu);
setJMenuBar(jMenuBar1);
pack();
}// </editor-fold>
private void smallRBActionPerformed(java.awt.event.ActionEvent
evt) {
pizzaPriceField.setText(SMALL_PIZZA_PRICE + "");
}
private void mediumRBActionPerformed(java.awt.event.ActionEvent
evt) {
pizzaPriceField.setText(MEDIUM_PIZZA_PRICE + "");
}
private void largeRBActionPerformed(java.awt.event.ActionEvent
evt) {
pizzaPriceField.setText(LARGE_PIZZA_PRICE + "");
}
private void
drinksComboBoxActionPerformed(java.awt.event.ActionEvent evt) {
if(drinksComboBox.getItemAt(drinksComboBox.getSelectedIndex()).equals("Select"))
drinksPriceField.setText("");
else
if(drinksComboBox.getItemAt(drinksComboBox.getSelectedIndex()).equals("Minute
Maid") ||
drinksComboBox.getItemAt(drinksComboBox.getSelectedIndex()).equals("Coca-Cola")
||
drinksComboBox.getItemAt(drinksComboBox.getSelectedIndex()).equals("Country
Time") ||
drinksComboBox.getItemAt(drinksComboBox.getSelectedIndex()).equals("Seven
Up"))
{
drinksPriceField.setText(SOFT_DRINKS_PRICE + "");
}
}
private void
doneButtonActionPerformed(java.awt.event.ActionEvent evt) {
double pizzaPrice =
Double.parseDouble(pizzaPriceField.getText().trim());
double addonPrice =
Double.parseDouble(addonsPriceField.getText().trim());
double drinksPrice =
Double.parseDouble(drinksPriceField.getText().trim());
String pizza = "", addOn = "", drink = "", order = "";
double totalPrice = (pizzaPrice + addonPrice + drinksPrice);
totalPriceField.setText(totalPrice + "");
if(smallRB.isSelected())
pizza = "Small";
else if(mediumRB.isSelected())
pizza = "Medium";
else if(largeRB.isSelected())
pizza = "Large";
if(pepperoniCB.isSelected() &&
anchoviesCB.isSelected())
addOn = "Pepperoni, Anchovies";
else if(pepperoniCB.isSelected() || anchoviesCB.isSelected())
{
if(pepperoniCB.isSelected())
addOn = "Pepperoni";
else if(anchoviesCB.isSelected())
addOn = "Anchovies";
}
drink =
drinksComboBox.getItemAt(drinksComboBox.getSelectedIndex()).toString();
order = "Pizza Order - Size: " + pizza
+ " | Add-ons: " + addOn
+ " | Soft drinks: " + drink
+ "\nPrice: $ " + totalPrice;
orderDetailsArea.setText("");
orderDetailsArea.setText(order);
}
private void
pepperoniCBItemStateChanged(java.awt.event.ItemEvent evt) {
if (evt.getStateChange() == ItemEvent.SELECTED) {
addonsPriceField.setText(Double.parseDouble(addonsPriceField.getText().trim())
+ ADDONS_PRICE + "");
} else {
addonsPriceField.setText(Double.parseDouble(addonsPriceField.getText().trim())
- ADDONS_PRICE + "");
}
}
private void
anchoviesCBItemStateChanged(java.awt.event.ItemEvent evt) {
if (evt.getStateChange() == ItemEvent.SELECTED) {
double addOnPrice =
Double.parseDouble(addonsPriceField.getText().trim()) +
ADDONS_PRICE;
addonsPriceField.setText(addOnPrice + "");
} else {
double addOnPrice =
Double.parseDouble(addonsPriceField.getText().trim()) -
ADDONS_PRICE;
addonsPriceField.setText(addOnPrice + "");
}
}
private void
newOrderMenuActionPerformed(java.awt.event.ActionEvent evt) {
sizeGroup.clearSelection();
smallRB.setSelected(false);
mediumRB.setSelected(false);
largeRB.setSelected(false);
pepperoniCB.setSelected(false);
anchoviesCB.setSelected(false);
drinksComboBox.setSelectedItem(drinksComboBox.getItemAt(0));
pizzaPriceField.setText("0.00");
addonsPriceField.setText("0.00");
drinksPriceField.setText("0.00");
totalPriceField.setText("0.00");
orderDetailsArea.setText("");
}
private void exitMenuActionPerformed(java.awt.event.ActionEvent
evt) {
System.exit(0);
}
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel
setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with
the default look and feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(PizzaFormFrame.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(PizzaFormFrame.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(PizzaFormFrame.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(PizzaFormFrame.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
//new PizzaFormFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JTextField addonsPriceField;
private javax.swing.JCheckBox anchoviesCB;
private javax.swing.JButton doneButton;
private javax.swing.JComboBox drinksComboBox;
private javax.swing.JTextField drinksPriceField;
private javax.swing.JMenuItem exitMenu;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JRadioButton largeRB;
private javax.swing.JRadioButton mediumRB;
private javax.swing.JMenu menu;
private javax.swing.JMenuItem newOrderMenu;
private javax.swing.JTextArea orderDetailsArea;
private javax.swing.JCheckBox pepperoniCB;
private javax.swing.JTextField pizzaPriceField;
private javax.swing.ButtonGroup sizeGroup;
private javax.swing.JRadioButton smallRB;
private javax.swing.JTextField totalPriceField;
// End of variables declaration
}
PizzaFormViewer.java
public class PizzaFormViewer {
public static void main(String[] args)
{
new PizzaFormFrame().setVisible(true);
}
}
Create two classes following the model shown in Chapter 19. Assuming your data form's subject is ...
JAVA Hello I am trying to add a menu to my Java code if someone can help me I would really appreacite it thank you. I found a java menu code but I dont know how to incorporate it to my code this is the java menu code that i found. import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ButtonGroup; import javax.swing.JCheckBoxMenuItem; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JRadioButtonMenuItem; public class MenuExp extends JFrame { public MenuExp() { setTitle("Menu Example");...
Purpose: Demonstrate the ability to create and manipulate classes, data members, and member functions. This assignment also aims at creating a C++ project to handle multiple files (one header file and two .cpp files) at the same time. Remember to follow documentation and variable name guidelines. Create a C++ project to implement a simplified banking system. Your bank is small, so it can have a maximum of 100 accounts. Use an array of pointers to objects for this. However, your...
Java Painter Class This is the class that will contain main. Main will create a new Painter object - and this is the only thing it will do. Most of the work is done in Painter’s constructor. The Painter class should extend JFrame in its constructor. Recall that you will want to set its size and the default close operation. You will also want to create an overall holder JPanel to add the various components to. It is this JPanel that...
could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...
New Perspectives on HTML5 and CSS3. Solve Chapter 13 Case Problem 3. mas_register.js "use strict"; /* New Perspectives on HTML5, CSS3, and JavaScript 6th Edition Tutorial 13 Case Problem 3 Filename: mas_register.js Author: Date: Function List ============= formTest() Performs a validation test on the selection of the conference session package and the conference discount number calcCart() Calculates the cost of the registration and saves data in session storage writeSessionValues() Writes data values from session storage in to the registration...
In a new file located in the same package as the class Main, create a public Java class to represent a photograph that consists of a linear (not 2D) array of pixels. Each pixel is stored as an integer. The photograph class must have: (a) Two private fields to represent the information stored about the photograph. These are the array of integers and the date the photograph was taken (stored as a String). The values in the array must be...
The following are screen grabs of the provided files Thanks so much for your help, and have a nice day! My Java Programming Teacher Gave me this for practice before the exam, butI can't get it to work, and I need a working version to discuss with my teacher ASAP, and I would like to sleep at some point before the exam. Please Help TEST QUESTION 5: Tamagotchi For this question, you will write a number of classes that you...
CSC 142 Music Player You will complete this project by implementing one class. Afterwards, your program will play music from a text file. Objectives Working with lists Background This project addresses playing music. A song consists of notes, each of which has a length (duration) and pitch. The pitch of a note is described with a letter ranging from A to G. 7 notes is not enough to play very interesting music, so there are multiple octaves; after we reach...