Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 24 additions & 42 deletions q1/q1.java
Original file line number Diff line number Diff line change
@@ -1,47 +1,29 @@
// FILL HERE: Import the necessary package for input operations
// Mayank Yadav
import java.util.Scanner;

public class q1 {
public static void main(String[] args) {

// FILL HERE: Write the class declaration with proper naming convention
{
// FILL HERE: Write the main method signature
{
// Variable declarations and initialization
// FILL HERE: Declare an integer variable named 'age' and initialize it to 25
String n = "John Doe";
int a = 25;
double h = 5.8;
char g = 'A';
boolean isStudent = true;

// FILL HERE: Declare a double variable named 'height' and initialize it to 5.8

// FILL HERE: Declare a char variable named 'grade' and initialize it to 'A'

// FILL HERE: Declare a boolean variable named 'isStudent' and initialize it to true

// FILL HERE: Declare a String variable named 'name' and initialize it to "John Doe"


// Output statements
System.out.println("=== Student Information ===");

// FILL HERE: Print the name using System.out.println

// FILL HERE: Print the age using System.out.println (format: "Age: 25")

// FILL HERE: Print the height using System.out.println (format: "Height: 5.8 feet")

// FILL HERE: Print the grade using System.out.println (format: "Grade: A")

// FILL HERE: Print the student status using System.out.println (format: "Is Student: true")


// Data type demonstration
System.out.println("\n=== Data Type Information ===");

// FILL HERE: Print the data type of age variable (hint: use "int")

// FILL HERE: Print the data type of height variable (hint: use "double")

// FILL HERE: Print the data type of grade variable (hint: use "char")

// FILL HERE: Print the data type of isStudent variable (hint: use "boolean")

// FILL HERE: Print the data type of name variable (hint: use "String")
System.out.println("Name: " + n);
System.out.println("Age: " + a);
System.out.println("Height: " + h + " feet");
System.out.println("Grade: " + g);
System.out.println("Is Student: " + isStudent);

System.out.println();
System.out.println("=== Data Type Information ===");
System.out.println("age is of type: int");
System.out.println("height is of type: double");
System.out.println("grade is of type: char");
System.out.println("isStudent is of type: boolean");
System.out.println("name is of type: String");
}
}
}