Question

For the final project, complete an independent application that includes all requirements listed in the rubric....

For the final project, complete an independent application that includes all requirements listed in the rubric. You can use applications from the book as models but do not copy exactly. Compile on ideone or an IDE and screenshot the results with a timestamp showing. I really need help creating a code that meets all requirements

Application written in Java

20

Application includes constant

5

App incudes 4 or more variables

5

App includes an array of 5 or more items

10

App includes one or more strings

5

App includes a loop

10

App produces output with explanatory text

10

App includes one or more event handlers

10

Paragraph or more on experience creating app

5

Screenshot submitted of code in compiler with a timestamp

10

Document submitted with explanations of code

10

Override grade: Screenshot w/timestamp OR explanatory document not submitted

0 0
Add a comment Improve this question Transcribed image text
Answer #1

JAVA CODE:


import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
*
* @author shubhamtunwal
*/
public class NewJFrame extends javax.swing.JFrame {

/**
* Creates new form NewJFrame
*/
public static final double pi = 3.14;

public NewJFrame() {
initComponents();
}

@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {

jScrollPane1 = new javax.swing.JScrollPane();
jTree1 = new javax.swing.JTree();
jb = new javax.swing.JButton();
jScrollPane2 = new javax.swing.JScrollPane();
jta = new javax.swing.JTextArea();

jScrollPane1.setViewportView(jTree1);

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jb.setText("Calculate Area");
jb.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbActionPerformed(evt);
}
});

jta.setColumns(20);
jta.setRows(5);
jScrollPane2.setViewportView(jta);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 613, Short.MAX_VALUE)
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jb, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jb)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 195, Short.MAX_VALUE)
.addGap(24, 24, 24))
);

pack();
}// </editor-fold>

private void jbActionPerformed(java.awt.event.ActionEvent evt) {   

// This code is inside the event handler which is a button
  
  
  
// 5 variables
int area_circle1;
int area_circle2;
int area_circle3;
int area_circle4;
int area_circle5;

//array containing radius of 5 circle as its items
int radii[] = new int[]{4, 9, 8, 7, 3};

// Using the for loop to calculate the area of each circle using the radius from array and with help of constant pi
for (int i = 0; i < radii.length; i++) {
//Explanatory text

double area = pi * radii[i] * radii[i];

int item_no = i + 1;

  
jta.append("We used for loop for " + i + "th iteration and using the " + item_no + "th item of radii array to calculate the area with the help of constant\n");
jta.append("The area of the circle with radius " + radii[i] + " is " + area + "\n\n");

}
}

/**
* @param args the command line arguments
*/
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(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(NewJFrame.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 NewJFrame().setVisible(true);
}
});
}

// Variables declaration - do not modify   
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTree jTree1;
private javax.swing.JButton jb;
private javax.swing.JTextArea jta;
// End of variables declaration   
}

Output:


Explanation:

  • We have used JFrame in this problem.
  • Button is created in JFrame and its used as an Event Handler with variable name as jb
  • Text Area with variable name jta is used as text area for output
  • We have declared 5 variables where the areas of circle is stored
  • We used for loop to calculate the area of each circle using the radius from radii array and with help of constant pi
  • In each iteration we stored the area into areas array
  • Finally using the value from areas array we stored the values into each of 5 variables

Screenshots of Code:

Add a comment
Know the answer?
Add Answer to:
For the final project, complete an independent application that includes all requirements listed in the rubric....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • in java : Create Java Application you are to create a project using our designated IDE...

    in java : Create Java Application you are to create a project using our designated IDE (which you must download to your laptop). Create the code to fulfill the requirements below. Demonstrate as stipulated below. Create a Main Application Class called AddressBookApplication (a counsole application / command line application). It should Contain a Class called Menu that contains the following methods which print out to standard output a corresponding prompt asking for related information which will be used to update...

  • AA. Final Project - Improved JavaFX GUI Personal Lending Library Description: In this project we will...

    AA. Final Project - Improved JavaFX GUI Personal Lending Library Description: In this project we will improve our personal lending library tool by (1) adding the ability to delete items from the library, (2) creating a graphical user interface that shows the contents of the library and allows the user to add, delete, check out, or check in an item. (3) using a file to store the library contents so that they persist between program executions, and (4) removing the...

  • Help Please on JAVA Project: Validating the input is where I need help. Thank you Requirements...

    Help Please on JAVA Project: Validating the input is where I need help. Thank you Requirements description: Assume you work part-time at a sandwich store. As the only employee who knows java programming, you help to write a sandwich ordering application for the store. The following is a brief requirement description with some sample output. 1. Selecting bread When the program starts, it first shows a list/menu of sandwich breads and their prices, then asks a user to select a...

  • In Module Four, submit a systems analysis for your project, including a comprehensive entity-relationship diagram (ERD)....

    In Module Four, submit a systems analysis for your project, including a comprehensive entity-relationship diagram (ERD). Although you may use any tool to complete the ERD, it is strongly recommended that you use Microsoft Visio and then save the diagram into an image format (GIF or JPG) and then copy and paste the image into your systems analysis. All sections of this milestone should be compiled into a single Word document. Furthermore, all of Milestone One should be included in...

  • It's time to put everything you've learned together and do something fun with Python! Be creative,...

    It's time to put everything you've learned together and do something fun with Python! Be creative, do your best, and have fun! Your project will be automatically included in the pool of students' work. If selected, your project will be used as a demonstration to current and prospective students in the future. Please let me know if you prefer NOT to include your project to be in the pool of demonstrating projects. Project Description Create a real-world scenario of a...

  • This C++ Program consists of: operator overloading, as well as experience with managing dynamic memory allocation...

    This C++ Program consists of: operator overloading, as well as experience with managing dynamic memory allocation inside a class. Task One common limitation of programming languages is that the built-in types are limited to smaller finite ranges of storage. For instance, the built-in int type in C++ is 4 bytes in most systems today, allowing for about 4 billion different numbers. The regular int splits this range between positive and negative numbers, but even an unsigned int (assuming 4 bytes)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT