

Java Programming Tutorial: In this video, I have solved few question from the Chapter 1 Practice Set. This practice set will contain all the questions for practice from our chapter 1: Variables and data types
►This playlist is a part of my Complete Java Course playlist:
►Source Code + Notes –
►Ultimate Java CheatSheet:
►Checkout my English channel here:
►Click here to subscribe –
Best Hindi Videos For Learning Programming:
►Learn Python In One Video –
►Python Complete Course In Hindi –
►C Language Complete Course In Hindi –
►JavaScript Complete Course In Hindi –
►Learn JavaScript in One Video –
►Learn PHP In One Video –
►Django Complete Course In Hindi –
►Machine Learning Using Python –
►Creating & Hosting A Website (Tech Blog) Using Python –
►Advanced Python Tutorials –
►Object Oriented Programming In Python –
►Python Data Science and Big Data Tutorials –
Follow Me On Social Media
►Website (created using Flask) –
►Facebook –
►Instagram –
►Personal Facebook A/c –
Twitter –
source
Ho sake to share kar dena Java Course Ki Playlist, Please!
Maza aa rha hai aapse padhne me ….sending you lots of love
Harry bahi CGPA total 4 nii hota ?
// Question 2 but it takes values from the user
Scanner sc = new Scanner(System.in);
System.out.println("enter the number of first subject");
float sub1 = sc.nextFloat();
System.out.println("enter the number of second subject ");
float sub2 = sc.nextFloat();
System.out.println("subject3");
float sub3 = sc.nextFloat();
System.out.println("subject4");
float sub4 = sc.nextFloat();
System.out.println("subject5");
float sub5 = sc.nextFloat();
System.out.println("subject6");
float sub6 = sc.nextFloat();
float cgpa = (sub1 + sub2 + sub3 + sub4 + sub5 + sub6)/30;
System.out.println("this is your cgpa");
System.out.println(cgpa);
The answer of the 4th one is:
public class Excersise {
public static void main(String[]args){
// convert kilometers into hours:
double kilometers=100;
double miles=kilometers/1.609;
System.out.println(miles);
}
}
5:39 mai aapne float number ke peche f nahi lagaya phir bhi kaise run hua
package revision_mode;
import java.util.Scanner;
public class percent {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner S = new Scanner(System.in);
System.out.println("enter subject1 number");
int subject1 = S.nextInt();
System.out.println("enter subject2 number");
int subject2 = S.nextInt();
System.out.println("enter subject3 number");
int subject3 = S.nextInt();
System.out.println("enter subject4 number");
int subject4 = S.nextInt();
System.out.println("enter subject5 number");
int subject5 = S.nextInt();
System.out.println("enter outoff");
int outoff = S.nextInt();
int total = subject1 + subject2+subject3+subject4+subject5;
System.out.println("total number get" + total);
int percentage = (total*100/outoff);
System.out.println(" you get" + percentage);
}
}
import java.util.Scanner;
public class kilometretomiles {
public static void main(String[] args) {
Scanner a = new Scanner(System.in);
System.out.println("enter the value");
float g = a.nextFloat();
float t = g/1.609344f;
System.out.println("we have converted km into miles "+t);
}
}
import java.util.*;
public class switchcase {
public static void main(String[] args) {
int day ;
int a;
int b;
int c;
int sum;
int max;
int a1;
int a2;
int a3;
double summ;
double per;
int cgpa ;
double aaa;
double miles;
String aa;
//switch scanner
Scanner s1 =new Scanner(System.in);
System.out.println(" Choose the Question");
day=s1.nextInt();
switch (day) {
case 1:{
// add 3 number
Scanner n1=new Scanner(System.in);
System.out.println("Enter 3 digit number");
a=n1.nextInt();
b=n1.nextInt();
c=n1.nextInt();
sum=a+b+c;
System.out.println("sum ="+sum);}
break;
case 2:{
// cacl cgpa but= marks < 100
Scanner s2=new Scanner(System.in);
System.out.println("enter full marks ");
max=s2.nextInt();
System.out.println("enter marks of 1st subject");
a1=s2.nextInt();
System.out.println("enter marks of 2nd subject");
a2=s2.nextInt();
System.out.println("enter marks of 3rd subject");
a3=s2.nextInt();
summ= a1+a2+a3;
System.out.println("Marks Obtained"+summ);
per=summ/(3*max)*100;
System.out.println("percentage="+per);
cgpa= (int) (per/9.5);
System.out.println("cgpa ="+cgpa);}
break;
case 3:
//concat name with greetings
{ Scanner s3 =new Scanner(System.in);
System.out.println("Enter your name");
aa= s3.nextLine();
System.out.println("Hello"+aa+ "have a good day");}
break;
case 4:
//km to miles
{Scanner s4=new Scanner(System.in);
System.out.println("Enter kilometer ");
aaa=s4.nextDouble();
miles=aaa/1.609;
System.out.println("miles="+miles);}
break;
case 5:
//check whether int or not
{ System.out.println("enter ur number");
Scanner s5 =new Scanner(System.in);
System.out.println(s5.hasNextInt());}
break;
}
}
}
in question 5, if v enter 23.0 then it gave false, why? And for a large integer(123456789), it also gave false.
idk why but intellij idea lags in my laptop, my laptop configs: 1tb, 8gb, ryzen 5 3500u
maja agya bro sirf ek session attend kiya and i can solve all of these questions now…
Hi @codewithharry ,
use of type casting is the best possible way and easy too.
int a=45;
int b= 95;
int c = 48;
float sum= (a+b+c)/30f;
System.out.println(sum);
import java.util.Scanner;
public class Begginer {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("Converting kilometer into miles ");
System.out.println("Enter the number: ");
float s=sc.nextInt();
float mile=s*0.621371F;
System.out.println(mile);
}
}
sir you are geatest teacher thank you so much
sir where is notes?
Hlo sir third question mai eh scanner sc kya hai mera error aa raha hai run ni hora program
Thnku so much sir
import java.util.Scanner;
public class BoardPercentageCalculator {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("CBSE Board Percantage Calculator");
System.out.println("Enter your MATHS mark here : ");
float m = sc.nextFloat();
System.out.println("Enter your PHYSICS marks here : ");
float p = sc.nextFloat();
System.out.println("Enter your CHEMESTRY marks here : ");
float c = sc.nextFloat();
System.out.println("Enter your BIO marks here : ");
float b = sc.nextFloat();
System.out.print("Enter your ENGLISH marks here : ");
float e = sc.nextFloat();
float Total = m+p+c+b+e;
System.out.println("Your total marks scored is = "+Total);
float per = (Total/500)*100;
System.out.print("You have scored "+per );
System.out.println("%");
System.out.println("THANKS FOR USING MY APP ");
}
}
whenever i run my program my IDE just crashes . any solution for this
because the cgpa is a floating or a double number.