forked from CodeX-SIT/community-25-java-task1-Java-Task1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathq1.java
More file actions
62 lines (43 loc) · 2.56 KB
/
q1.java
File metadata and controls
62 lines (43 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// FILL HERE: Import the necessary package for input operations
import java.util.Scanner;
// FILL HERE: Write the class declaration with proper naming convention
public class q1 {
// FILL HERE: Write the main method signature
public static void main(String[] args) {
// Variable declarations and initialization
// FILL HERE: Declare an integer variable named 'age' and initialize it to 25
int age = 25;
// FILL HERE: Declare a double variable named 'height' and initialize it to 5.8
double height = 5.8;
// FILL HERE: Declare a char variable named 'grade' and initialize it to 'A'
char grade = 'A';
// FILL HERE: Declare a boolean variable named 'isStudent' and initialize it to true
boolean isStudent = true;
// FILL HERE: Declare a String variable named 'name' and initialize it to "John Doe"
String name = "John Doe";
// Output statements
System.out.println("=== Student Information ===");
// FILL HERE: Print the name using System.out.println
System.out.println("Name: " + name);
// FILL HERE: Print the age using System.out.println (format: "Age: 25")
System.out.println("Age: " + age);
// FILL HERE: Print the height using System.out.println (format: "Height: 5.8 feet")
System.out.println("Height: " + height + " feet");
// FILL HERE: Print the grade using System.out.println (format: "Grade: A")
System.out.println("Grade: " + grade);
// FILL HERE: Print the student status using System.out.println (format: "Is Student: true")
System.out.println("Is Student: " + isStudent);
// Data type demonstration
System.out.println("\n=== Data Type Information ===");
// FILL HERE: Print the data type of age variable (hint: use "int")
System.out.println("age is of type: int");
// FILL HERE: Print the data type of height variable (hint: use "double")
System.out.println("height is of type: double");
// FILL HERE: Print the data type of grade variable (hint: use "char")
System.out.println("grade is of type: char");
// FILL HERE: Print the data type of isStudent variable (hint: use "boolean")
System.out.println("isStudent is of type: boolean");
// FILL HERE: Print the data type of name variable (hint: use "String")
System.out.println("name is of type: String");
}
}