Question
Assignment Specification: Create a Netbeans Project by The name of AllJavaBasicProgram. The code provided in this assignment you can use that information to complete the
Assignment Specification:
Create a Netbeans Project by The name of AllJavaBasicProgram.
The code provided in this assignment you can use that information to complete the assignment.
You need to give brief information about each Java basic data types, arrays, loops, conditionals, Class & Objects, functions/methods(Static / Non-Static), Packages, Inheritance, polymorphism, encapsulation, abstraction, file Operations, exception handling, and Database Connectivity using print statements and #Comments, and then you need to give a practical example in question-answer format which an example is provided in the next slide.
The example:
import java.util.Scanner;
public Class AllBasics{
public static void main(String args[])
int a =0;
while(true){
System.out.println("Enter 1 For Variables Function");
System.out.println("Enter 2 For Array Function");
System.out.println("Enter 3 For if Else condition ");
System.out.println("Enter 4 For Switch statement ");
System.out.println("Enter 5 For Do while Loop");
System.out.println("Enter 6 for For Loop ");
System.out.println("Enter 7 for while loop ");
System.out.println("Enter 0 to Exit the program ");
Scanner input = new Scanner(System.in);
try {
a=input.nextInt();
}
catch(Exception e){
System.out.println("Only Enter Integers " + e);
}
switch (a){
case 1:
f1();
break;
case 2:
f2(); // create a method to show how array works in java
break;
case 3:
f3(); // Create a Method and practice some examples if/else if
break;
case 4:
f4(); // Create a method and practice some for switch examples
break;
case 5:
f5(); // Create a method and practice some Do while loop examples
break;
case 6:
f6(); // Create a method and practice some for loop examples
break;
case 7:
f7(); // Create a method and practice some while loop examples
break;
}
if(a==0){
break;
}
}
}
static void f1(){
System.out.println("Varaible is memory location which we can store some data in it and it is changeable.");
System.out.println("Variable Structure: datatype varname = varvalue; e.g. int age = 10; ");
System.out.println(" Or Variable declaration: datatype varname; e.g. int age;");
System.out.println("Variable initialization: varanme = varvalue; e.g. age = 10;");
System.out.println("Data Types are : Integer(int) Float(float) Character(char) Double (double)");
Scanner scan = new Scanner(System.in);
System.out.println("Enter a String or Name of some one here : ");
String name=scan.next();
System.out.println("Enter an integer or age of someone : ");
int age=scan.nextInt();
System.out.println("Your Name is "+name+" Your Age is "+age);
}
}
Please give comments in it so I can explain in the powerpoint slide professor has asked to give voice recorded explanation of each code. Thank you a lot I really appreciate it.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started