1- Explain the basic principles of programming, concept of language. Universal constructs of programming languages.

Write a complete Java program to print the following:

Your name
The CRN number for your Class
Note: Include the screenshot of program output as a part of your answer.

2- Demonstrate Integrated Development Environment (IDE) for the editing, building, debugging, and testing of programs.

The following program is written to calculate the addition for two numbers (9,3). Unfortunately, the program has Compile-time and Run-time errors that prevent the program from running and producing the correct result. Using the Table 2.1 below, allocate the error(s) on each program line.

// define new class
public Calculation {
private int result_add
// define add method to add two numbers
intnumber1 = first_number;
double number2 = second_number;
result_add= number1/number2;
}
/ return the value
public int getvalue()
{
return result_add;
}
public static void main(String[] args) {
// define new object with name summation
Calculation summation = Calculation();
summation.add(9,3);
int result= getvalue();
System.println(result);
}
}
}
5.public void add(int first_number,int second_number) {

3- Write a complete Java program to create three types of counters as follows:

The first counter increases its value by one.
The second counter increases its value by two.
The third counter increases its value by three.
Please follow these notes:

Create one class for all counter types. The name of the class is Three_type_counter.
Define a constructor method that initial values for all counters to 7 when the class object created.
Create method for each counter as: count1, count2 and count3. Each method has to increase each counter value by one, two and three respectively.

Sample Solution

This question has been answered.

Get Answer