Project #60909 - Programming Project #1 – Simple Programming Exercises

This project assumes you have followed the NetBeans instructions and can create and run a simple Java program using NetBeans. If you have NOT done this, STOP, go back and practice the NetBeans instructions. 

Create a folder on your memory stick or your laptop hard drive for ALL your java projects. Something like 'e:\javaprojects' or 'c:\javaprojects', your drive letter may be different. If you are using the lab computer hard drive, you MUST email the code to your self when you are done.

Exercise1_3 Create a NetBeans project named 'Project1'. Create a main class with the name 'Exercise1_3'. In the main method insert print statements which display the following pattern:

    J     A     V     V    A     
    J    A A     V   V    A A    
J   J   AAAAA     V V    AAAAA   
 J J   A     A     V    A     A  

It will take four(4) print line statements to complete the exercise.

MyInitials DO NOT create another project, we are going to add a new file to 'Project1'. From the NetBeans 'File' menu select 'New File'. On the dialog box under 'File Type' select 'Java Main Class' and hit 'Next'. Create a main class with the name 'MyInitials', verify it is part of 'Project1' and press 'Finish'. In the main method insert print statements to display your initials (2-3 letters) using an 8 X 8 pattern. For example, here is an 8 X 8 pattern of the letter 'J':

       J
       J
       J     
       J     
       J     
J      J   
J      J  
 J J J   

It will take eight (8) print line statements to complete the exercise. From the Project Navigator you can run the new program by right clicking on the file name and selecting 'Run File' or if the file is active in the editor window press 'Shift - F6'.

WelcomeInMessageDialogBox DO NOT create another project, we are going to add a new file to 'Project1'. From the NetBeans 'File' menu select 'New File'. On the dialog box under 'File Type' select 'Java Main Class' and hit 'Next'. Create a main class with the name 'WelcomeInMessageDialogBox', verify it is part of 'Project1' and press 'Finish'. You are going to implement the program from the book, Section 1.10 (GUI) Displaying Text in a Message Dialog Box:

  // place this code near the top, ABOVE the class WelcomeInMessageDialogBox
  import javax.swing.JOptionPane;

  // place this code IN the main method
   JOptionPane.showMessageDialog(null, "Welcome to Java");

Place the code into the proper position and run the program to make sure it works. From the Project Navigator you can run the new program by right clicking on the file name and selecting 'Run File' or if the file is active in the editor window press 'Shift - F6'.

 

Note: Just a reminder, add your work to the 'Project1' folder. If you are using a memory stick or laptop you can run NetBeans and from the 'File' menu select 'Open Project...", locate and open your 'Project1'. If you are using the lab computer hard drive, you MUST create 'Project1' from scratch, then copy and paste your existing code from your email.

ConvertTemp DO NOT create another project, we are going to add a new file to 'Project1'. From the NetBeans 'File' menu select 'New File'. On the dialog box under 'File Type' select 'Java Main Class' and hit 'Next'. Create a main class with the name 'ConvertTemp', verify it is part of 'Project1' and press 'Finish'. In the main method create code which converts celsius to fahrenheit using the formula:

   fahrenheit = (9.0 / 5.0) * celsius + 32.0;

You need to create two variables (inside main), and print the result of the calculation. If you want the value of a variable to print, DO NOT place the variable name in "quotes". At first, just assign simple values to the variable celsius like 0 or 100. If you can get that to work, try to input the value of celsius from the keyboard. Be sure to do a "import java.util.Scanner;" above the "public class ConvertTemp" line.

CalculateCylinder From the NetBeans 'File' menu select 'New File'. On the dialog box under 'File Type' select 'Java Main Class' and hit 'Next'. Create a main class with the name 'CalculateCylinder', verify it is part of 'Project1' and press 'Finish'. In the main method create code which calculates and prints the volume of a cylinder using the formulas:

   area = radius * radius * 3.14159; // that is pi
   volume = area * length;

You need to create four variables(inside main), and print the result of the calculations. If you want the value of a variable to print, DO NOT place the variable name in "quotes". At first, just assign simple values to the variables radius and length. If you can get that to work, try to input the values of radius and length from the keyboard. Be sure to do a "import java.util.Scanner;" above the "public class CalculateCylinder" line.

FeetMeters From the NetBeans 'File' menu select 'New File'. On the dialog box under 'File Type' select 'Java Main Class' and hit 'Next'. Create a main class with the name 'FeetMeters', verify it is part of 'Project1' and press 'Finish'. In the main method create code which converts feet to meters, using the formula:

   1 foot = .305 meters  // this is NOT Java, you create the Java

You need to create two variables (inside main), and print the result of the calculation. At first, just assign a simple value to the variable feet. If you can get that to work, try to input the value of feet from the keyboard.

CalculateTip From the NetBeans 'File' menu select 'New File'. On the dialog box under 'File Type' select 'Java Main Class' and hit 'Next'. Create a main class with the name 'CalculateTip', verify it is part of 'Project1' and press 'Finish'. In the main method create code which calculates and prints a tip amount and a total using the formulas:

   tip = subtotal * tiprate;
   total = subtotal + tip;

You need to create four variables (inside main), and print the results of the calculations (tip and total). At first, just assign a simple value to the variables. If you can get that to work, try to input the values from the keyboard. Final Exercise For Project #1 - A textbook is required - ONLY DO THIS WHEN YOU HAVE COMPLETED ALL OTHER PROGRAMS

CalculateTipGUI Do this exercise using a GUI interface. Create a new class CalculateTipGUI and use dialog boxes for the input AND output of the program. 
See the GUI programming sections at the end of chapter 1 (1.9) and 2 (2.19) for instructions on GUI input and output. 

Subject Computer
Due By (Pacific Time) 03/05/2015 01:30 pm
Report DMCA
TutorRating
pallavi

Chat Now!

out of 1971 reviews
More..
amosmm

Chat Now!

out of 766 reviews
More..
PhyzKyd

Chat Now!

out of 1164 reviews
More..
rajdeep77

Chat Now!

out of 721 reviews
More..
sctys

Chat Now!

out of 1600 reviews
More..
sharadgreen

Chat Now!

out of 770 reviews
More..
topnotcher

Chat Now!

out of 766 reviews
More..
XXXIAO

Chat Now!

out of 680 reviews
More..
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy