Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part I: IntelliJ Project and Java Main File ( 2 pts ) 1 . Create a new IntelliJ java project called Lab _ 0 4

Part I: IntelliJ Project and Java Main File (2 pts)
1. Create a new IntelliJ java project called Lab_04_Java_Variables use the default java 1.8 and dont select anything else on the initial screen. Note: your instructor will demonstrate this in class and there is a Video that demos it.
(We are not allowed to use spaces in project names for GitHub so we will get in the habit of avoiding them by using underscores _.)
2. Choose the Create Project from Template and the Command Line App template which will create a Main.java file. All your code will go in the main.java file
3. If your instructor indicated that you should use GitHub, add your project to GitHub
a. Goto the VCS (Version Control System) on the main menu bar in IntelliJ and choose Share Project on GitHub
b. Add a description usually Project init to indicate that you are just creating the project and click share.(For this first time, I recommend that you open your GitHub account in the Web browser and confirm that your project was created and later, after you work on it, updated!!!)
Take a break and check with your fellow learners. Was everyone able to create the project files correctly? (If you are taking the course online, be sure to watch the support videos before you do this lab! Refer to them if you have trouble. Dont delay with this. You cant proceed with the course if you cant use the IDE.)
Now continue:
Click the arrow next to the src folder in your project to expand it. Now you can see the main.java file that was created from the template. All your code goes in this file within the method called main.
Within your file declare and initialize a series of numeric variables. Put them one per line like this example:
int intOperandA =1:
... next variable declaration here...
Here are the int (integer) variables to declare:
intOperandA, intOperandB, intSum, intProduct, intDifference, intQuotient, intModulo
You can set these to simple integer values of your own choice. Make them all different: 15,13,24, etc.
Next:
In the same way, create a series of double value variables=s.(These can have fractional values like 3.50.)
double doubleOperandA =3.50; // This is a declaration and initial assignment
Create declarations again, one per line, for each of these.
doubleOperandA, doubleOperandB, doubleSum, doubleProduct, doubleDifference, doubleQuotient
Note that we do not include the type of variables i.e. int, double, boolean, etc in the name of the variables. Im having you do that here this one time so you can observe how the typing effects the arithmetic operations.
Now create assignment statements using your variables for each of these arithmetic operations for both the int and the double types:
+,-,*,/,%(that last one is remainder and is called modulo) Create a complete sentence output statement that displays the results of the operation and the two operands.
Example:
intSum = intOperandA + intOperandB; // Assignment that uses the arithmentic operator +
System.out.println(The sum using ints of + intOperandA ++ intOperandB + is + intSum); // Output statement
Do this with the int variables for each of the operations (+ sum, * product, - difference, / quotient, and % modulo.
Notice how we include a space before and after each operator to increase readability.
Get in the habit of typing the code this way.
Get in the habit of typing the code this way.
Get in the habit of typing the code this way.
Now do the same thing with the double variables
Now, execute (that is run) your program. Right click on your main.java file in the project view and choose Run main. Alternatively, you can run the program by clicking run on the top menu bar.
Size the output window so you can see the results of the println statements for these expressions and grab a screen shot of your desktop that shows this. Alternatively, and what often works better for me, copy the output window as text and paste it into this document.
[Windows: Alt + printScrn key puts image of desktop in clipboard just use past to insert it here in to this document.
Mac: I think Apple /Command +2 or 3 does the same thing.]
Be sure when you do these screen shots or output copies that they clearly show me the work I asked you to do. We use this to grade your work. It is assumed that you will completely test and debug your code before submitting it and the grading process is primarily simply confirming you completed the assigned work.
If you have a problem completing the assignment, seek help from your instructor, the tutor, etc. Dont wait for help, you will fall behind...
Insert the screen shot here:
Did any of these results surprise you? (If not, take another look at the result of int division)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming Languages 12th International Symposium Dbpl 2009 Lyon France August 2009 Proceedings Lncs 5708

Authors: Philippa Gardner ,Floris Geerts

2009th Edition

3642037925, 978-3642037924

More Books

Students also viewed these Databases questions

Question

Identify the different methods employed in the selection process.

Answered: 1 week ago

Question

Demonstrate the difference between ability and personality tests.

Answered: 1 week ago