CS140 Computer Programming I Assignment


CS140 Computer Programming I Assignment

Question One

Create a java program for Student profile with the following requirements.

a) Each Student has: two variables id, and name.

b) A Student can be initialization with two constructers:

• Constructer without parameters, that set the id to zero and the name to an empty string.
• Constructer with tow parameters to initialize the variables id and name by a specific value.

c) Add a set method for each variable that change them to a specific value.

d) Add a get method for each variable which return its value.

To test the program, create a class StudentTest with the main method.

In the main method:

a) Create two empty Student profiles S1and S2.
b) Print the S1and S2 information.
c) Create a new student profile S3, specify the student id and name.
d) Change S3id and name.
e) Print the id and name of S3.

Question Two

For each of the code fragmentor declarations in the first column, state whether the code fragment is correct or incorrect. In case it is incorrect, please provide the correct code in the appropriate cell.

Code fragment

Correct orIncorrect ?

If incorrect, rewrite the correct code

char x=A

 

 

int z = 20,000;

 

 

double weight = "65";

 

 

public class Count

{

public Count()

   {

// body--filled in here

   }

// body--filled in here

  }

 

 

long 1student=123456;

 

 

boolean static = true;

 

 

Import java.String.Rectangle

 

 

public int void deposit(double amount)

{ . . . }

 

 

Question Three

A.Write an algorithm in pseudocode to convert temperature from Fahrenheit to Celsius?

B. Give an example for compile-time and run-time errors?

Question Four

Explain why the communication message that is sent may not be the message that is received between the agents?

Format your assignment according to the following formatting requirements:

1. The answer should be typed, double spaced, using Times New Roman font (size 12), with one-inch margins on all sides.

2. The response also includes a cover page containing the title of the assignment, the student's name, the course title, and the date. The cover page is not included in the required page length.

3. Also include a reference page. The Citations and references should follow APA format. The reference page is not included in the required page length.

Solution Preview :

Prepared by a verified Expert
Programming Languages: CS140 Computer Programming I Assignment
Reference No:- TGS03013916

Now Priced at $30 (50% Discount)

Recommended (94%)

Rated (4.6/5)