Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 4.1: About My Friend (10 pts) Open up a new Java project in Eclipse. Name the project friend Add a new class to your

Assignment 4.1: About My Friend (10 pts)

  • Open up a new Java project in Eclipse.
  • Name the project friend
  • Add a new class to your project also named Friend
  • Inside of Friend.java, write your name and section info at the very top of the file by placing them inside of a multi-line comment, like so:

/**

* @author Your Name Here

* @author Your Partner's Name (optional)

* CIS 36A, Assignment 4.1

*/

  • The objective of your program is to store some values in a variable and then print those values to the console.
  • Now, declare 5 new variables at the top of your program
  1. One integer
  2. Two chars
  3. One double
  4. One boolean
  • The integer variable will be used to store the number of years you have known your friend. Give it an appropriate name of your choice.
  • The char variable will be used to store the first initial of your friend's first name. Give it an appropriate name of your choice.
  • The other char variable will be used to store the first initial of your friend's last name. Give it an appropriate name of your choice.
  • The double variable will be used to store your friend's age. Give it an appropriate name of your choice.
  • The boolean variable will be used to store whether you plan friend is also a student at de Anza.
  • Next, assign the correct value to each of these variables. You many do this on the same line in which you declared the variables, or on a separate line.
  • For example, you might have a statement that looks like this:

int numYears = 5;

  • Or, you might have 2 statements that look like this:

int numYears;

numYears = 5;

  • Both options are correct.
  • Next, you will print out the contents of these variables using System.out.print() statements.
  • You need one System.out.println statement per variable.
  • statement 1 should say: I have known my friend for years.
  • statement 2 should say: My friend's initials are:
  • statement 3 should say: My friend is years old.
  • statement 4 should say: My friend is also a student at de Anza:
  • Thus, when your program is run, the output should be identical to the following (except your information will be below, not my sample information):

I have known my friend for 5 years.

My friend's initials are: KZ

My friend is 19.0 years old.

My friend is also a student at de Anza: true

  • When you are finished, and your output is identical to the sample output above (but with your information, not mine), submit the Friend.java file to Canvas.
  • Reminder: Look under workspace -> student -> src -> Friend.java

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

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions

Question

3. You can gain power by making others feel important.

Answered: 1 week ago