Skip to content
Tejsumeru

Thoughts Become Reality

  • Tutorials
  • Video Tutorial
  • Tutorials
  • Video Tutorial
  • Java

    Write a java program which generates student grade report in console. Take student roll number and marks (out of 100) of 5 courses from user. Calculate the percentage and display grade of the student. Use appropriate control statements.

    December 15, 2019 - By tejsumeru.12@gmail.com

    The below program shows how to use array and store student’s details and fetch details. Here we are using for each loop which is used to iterate throughout entire array element. Example import java.util.Scanner; class FindGrade { //get roll number and marks of student and calculate percentage and grade public static void main(String args[]) { int sub[],i,total=0; float per=0.0f; Scanner sc; String rNo; sub=new int[5]; sc=new Scanner(System.in); System.out.println("Enter Roll Number"); rNo=sc.next(); for(i=0;i<5;i++) { System.out.println("Enter Marks Of Subject "+(i+1)); sub[i]=sc.nextInt(); total=total+sub[i]; } per=total*100/500; System.out.println("\n***** Details Of Student *****\n"); System.out.println("\nRoll Number "+rNo); System.out.println("Total Marks Gained Is "+total); System.out.println("Percentage Gained Is "+per); if(per>90)…

    Continue Reading
  • Java

    Demonstrate concept of Arithmetic & Bitwise Operators with a java program. Operands to be considered as per the operators entered by the user.

    December 14, 2019 - By tejsumeru.12@gmail.com

    The below program performs arithmetic and bitwise operations based on number entered by user. Scanner class is used to take input from the user, which is inside java.util.Scanner  class. System.in is used to use input classes. Example import java.util.Scanner; class ArithmeticOperation { //arithmetic operation on float data public static void main(String args[]) { int n1,n2; int fChoice; Scanner sc=new Scanner(System.in); System.out.println("Select Choice\n"); System.out.println("1. Arithmetic Operation"); System.out.println("2. Bitwise Operation"); System.out.println("Enter Your Choice"); fChoice=sc.nextInt(); System.out.println("\nEnter First Value"); n1=sc.nextInt(); System.out.println("Enter Second Value"); n2=sc.nextInt(); switch(fChoice) { case 1: ArithmeticOp(n1,n2); break; case 2: BitwiseOp(n1,n2); break; default: System.out.println("Invalid Choice"); break; } } public static void ArithmeticOp(int…

    Continue Reading
  • Java

    Write a Java program using class that prints the numbers 1 to 50. For all multiples of 3 print “Fizz” and for all multiples of 5 print “Bizz”. For multiples of both 3 and 5 print “Fizz-Bizz”.

    December 14, 2019 - By tejsumeru.12@gmail.com

    In this program, we iterate the loop and print Fizz when the current number is multiple of 3, and print Bizz when the current number is multiple of 5, and print Fizz-Bizz when the current number is multiple of 3 and 5. The below example illustrate this. Example class FizzBizzDemo { //print fizz when number is multiply by 3 and bizz when number is multiply by 5 and for both print fizz-bizz public static void main(String args[]) { int i; for(i=0;i<=50;i++) { if(i%3==0 && i%5==0) { System.out.println(i+" - Fizz-Bizz"); } else { if(i%3==0) { System.out.println(i+" - Fizz"); } else if(i%5==0)…

    Continue Reading
  • Java

    Write a Java program to get particulars of his/her birthday and display it as shown below. Use 3 variables to hold date, month and year.

    December 14, 2019 - By tejsumeru.12@gmail.com

    In this we are taking date, month and year with three different variable and then check whether the date is valid or not. The below program shows how to check whether the data value is valid or not. Example import java.util.*; class GetBirthDate { //get the birthdate of his or her public static void main(String args[]) { int dt,month,year,leap=0,noOfDay=0; Scanner sc=new Scanner(System.in); System.out.println("Enter Birth Year"); year=sc.nextInt(); if(year>2019) { System.out.println("Year Is Invalid Please Enter Proper Year"); } else { if(year%4==0) { leap=1; } System.out.println("Enter Birth Month"); month=sc.nextInt(); switch(month) { case 1: noOfDay=31; break; case 2: if(leap==1) noOfDay=29; else noOfDay=28; break; case…

    Continue Reading
  • Java

    Write a Java program to print the ASCII values for characters entered by the user.

    December 13, 2019 - By tejsumeru.12@gmail.com

    Character is stored in its ASCII format in java. The standard set of character known as ASCII still ranges from 0 to 127 as always. Example: import java.util.Scanner; class FindASCII { //get ASCII value of character public static void main(String args[]) { char c,con; int i; Scanner sc; do { sc=new Scanner(System.in); System.out.println("Enter Any Character"); c=sc.next().charAt(0); i=c; System.out.println("ASCII Value Of "+c+" Is "+i); System.out.println("Do You Want To Continue (y/n) "); con=sc.next().charAt(0); }while(con=='y' || con=='Y'); } } OutPut Enter Any Character T ASCII Value Of T Is 84 Do You Want To Continue (y/n) n  

    Continue Reading
  • Java

    Justify the following statement in the context of Java. “ boolean can be true (Non-zero) or false(Zero)”.

    December 13, 2019 - By tejsumeru.12@gmail.com

    In java boolean datatype is used to take value true or false.  This is the type that is returned by all relational operators, as in the case a<b. boolean is also required by conditional expressions that govern the control statement such as if and for. In previous we learn about primitive datatype which give introduction of basic java’s data type. We know that boolean only take the value either true or false. Unlike in C where the boolean also takes 0 and 1 to determine false and, true  this is the not case in java. Example The below example shows…

    Continue Reading
  • Java

    Write a Java program to display all primitive type variables. Also display your name in the last line.

    December 13, 2019 - By tejsumeru.12@gmail.com

    The basic primitive datatypes are listed below. Integer Floating Point Character Boolean Here this types also categorized in other datatypes as follow. Integer This all stores signed, positive and negative values. byte short int long Floating Point Floating Point also known as real number are used when evaluating expression that require fraction precision. float double Character take ASCII value. In java char is 16 bit type. The range of char is 0 to 65535. There is no negative char. In java, boolean data type we cannot assign 0 or 1 or any numeric value to determines true or false. It…

    Continue Reading
Newer Posts 

Categories

  • Android With Java
  • Android With Kotlin
  • C language
  • C++ Language
  • Data Structure
  • Error Solving
  • Flutter
  • Go Lang
  • Interview Quetions
  • Java
  • Javascript
  • Kotlin
  • Machine Learning
  • MATLAB
  • PHP
  • Python
  • SciPy
  • Tutorials
  • Wordpress
Graceful Theme by Optima Themes