Posts

Showing posts from May, 2020

Lesson 4 If Else If Condition statement to Compute Scholarship discount using Relational Operators Sample Program Explained

Image
Logical Operators Example Statement • && and • || Or • ! Not Problem : if else if • Input grade , determine if grade is 100-99 to avail 100% discount, 96-98 to avail 50% discount 94-95 25% discount otherwise no discount. Compute and display discount and amount due. 1. Input name, grade , tuition 2. Determine the discount : if grade is 100-99 to avail 100% discount, 96-98 to avail 50% discount 94-95 25% discount otherwise no discount. 3. Compute and display discount and amount due. package ifelseif_scholarship; import java.io.*; import javax.swing.*; public class IfElseIf_Scholarship { public static void main(String[] args) { //declare global variables double grade, discount,tuitionFee ,amountDue; String name,scholarship_grant; name=JOptionPane.showInputDialog(null, "Enter your name"); grade =Double.parseDouble(JOptionPane.showInputDialog(nu...

lesson 2 math operations Using Java Netbeans IDE 8.2 Featuring the Scanner input Reader

Image
package firstprograms; import java.util.Scanner ; import java.io.*; public class MathBasic {   public static void main(String args[])   {     Scanner in=new Scanner (System.in).useDelimiter("\n"); //Class needed to use scanner input reader     //list of variables to store 2 input numbers      float n1,n2 ;     // list of variables to store computer values      double sum, diff,quotient,product;           //input first numbers ;      System.out.print("Ënter first number : ");       //read and store input number       n1=in.nextInt();            //input second numbers ;      System.out.print("Ënter second number :");       //read and store input ...

lesson 1 Easy Java Program , Input using Scanner , and output statement, Complete and Detailed Explanation Per Line

Image
package firstprograms; import java.io.*;    // library required for scanner input output functions import java.util.Scanner;   // library required for scanner input reader public class InputOutput {         public static void main(String args [])             {                     // list of variables                 String name ;   // String type stores text , characters and numbers                 int age;        // int store whole numbers                 Scanner in = new Scanner(System.in).useDelimiter("\n");   /...