Some java programs part 2

these are some simple java programs that may help you.
##6## A leading newspaper pays all their freelance writers at a rate of Tk. 500 per published article. Draw the flowchart for a program that will read the number of published articles for one writer, and print the total monthly fees for that writer.

/* time : 5.56pm
 * author: Anik*/
import java.util.Scanner;
public class Faraz6 {
  public static void main (String [] args) {
    Scanner input= new Scanner (System.in);
    System.out.println("Input Number(s) Article");
    int a, fees;
    a= input.nextInt();
    fees= (a*500);
    System.out.println("Total Fees: "+fees);
  }
}

##7##Write a program that takes as input your final marks and shows as output the letter grade.

/*Time: 9:28pm
 * Author: Anik Das*/
import java.util.Scanner;
public class Faraz7{
  public static void main (String [] args){
    Scanner input=new Scanner (System.in);
    int n=0;
    System.out.println("Enter your final marks");
    n=input.nextInt();
    if (n>=90){
      System.out.println("Your Latter Grade is A");
    }else{
      if (n>=85){
        System.out.println("Your Latter Grade is A-");
      }else{
        if (n>=80){
          System.out.println("Your Latter Grade is B+");
        }else{
          if (n>=75){
            System.out.println("Your Latter Grade is B");
          }else{
            if (n>=70){
              System.out.println("Your Latter Grade is B-");
            }else{
              if (n>=65){
                System.out.println("Your Latter Grade is C+");
              }else{
                if (n>=60){
                  System.out.println("Your Latter Grade is C");
                }else{
                  if (n>=57){
                    System.out.println("Your Latter Grade is C-");
                  }else{
                    if (n>=55){
                      System.out.println("Your Latter Grade is D+");
                    }else{
                      if (n>=52){
                        System.out.println("Your Latter Grade is D");
                      }else{
                        if (n>=50){
                          System.out.println("Your Latter Grade is D-");
                        }else{
                          System.out.println("Your Latter Grade is F");
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}


##8##. Write a flowchart for a program that performs four functions of a calculator. The program should request the user to enter a floating-point number, an operator and another floating-point number. It should then carry out the specified arithmetical operation: adding, subtracting, multiplying, or dividing the two floating-point numbers. Finally, it should display the result.

/*time: 9.59pm
 * autthor: Anik Das
 * Question: Write a flowchart for a program that performs four functions of a calculator.
 * The program should request the user to enter a floating-point number,
 * an operator and another floating-point number.
 * It should then carry out the specified arithmetical operation:
 * adding, subtracting, multiplying, or dividing the two floating-point numbers.
 * Finally, it should display the result.*/
import java.util.Scanner;
public class Faraz8{
  public static void main (String [] args){
    float n, a, s;
    Scanner input= new Scanner (System.in);
    System.out.println("ENTER 1ST NUMBER");
    n= input.nextFloat();
    System.out.println("ENTER 2ND NUMBER");
    a= input.nextFloat();
    System.out.println("ENTER OPERATOR.ENTER 0 FOR ADDITION, 1 FOR SUBSTRUCTION, 2 FOR MULTIPLICATION, 3 FOR DIVISIOIN ");
    String p;
    int x=input.nextInt();
    if (x==0){
      s=n+a;
      System.out.println("YOUR RESULT IS : "+s);
    }else{
      if (x==1){
        s=n-a;
        System.out.println("YOUR RESULT IS : "+s);
      }else{
        if (x==2){
          s=n*a;
          System.out.println("YOUR RESULT IS : "+s);
        }else{
          if (x==3){
            s=n/a;
            System.out.println("YOUR RESULT IS : "+s);
          }else{
            System.out.println("WRONG OPERATOR");
          }
        }
      }
    }
  }
}



##9##question: Write a program that calculates the tax as follows:

  • a) No tax if you get paid less than 10,000
  • b) 5% tax if you get paid between 10K and 20K
  • c) 10% tax if you get paid more than 20K
  • d) NO TAX IF YOU ARE LESS THAN 18 YEARS OLD.
  • e) NO TAX IF YOU ARE THE PRESIDENT OF THE COMPANY
  •  

/*Time:11.45am
 * Author: Anik das
 * question: Write a program that calculates the tax as follows:
a) No tax if you get paid less than 10,000
b) 5% tax if you get paid between 10K and 20K
c) 10% tax if you get paid more than 20K
d) NO TAX IF YOU ARE LESS THAN 18 YEARS OLD.
e) NO TAX IF YOU ARE THE PRESIDENT OF THE COMPANY*/
import java.util.Scanner;
import java.util.Scanner;
public class faraz9{ //original class TaxCalc
  public static void main (String [] args){
    Scanner input = new Scanner (System.in);
    int pre;
    pre=5;
    int age=0;
    int sal=0;
    double tax=0;
    System.out.println("Are you president of a company? enter 1 for yes if no enter 0");
    pre = input.nextInt();
    if(pre==1){
      System.out.println("NO TAX");
    }else{
      System.out.println("Enter your age");
      age=input.nextInt();
      if (age<18){
        System.out.println("NO TAX");
      }else{
        System.out.println("Enter yor sallery");
        sal=input.nextInt();
        if ((sal>=10000) && (sal<20000)){
        tax=sal*0.05;
        System.out.println("Your TAX is : Taka "+tax);
      }else{
        tax=sal*0.1;
        System.out.println("Your TAX is : Taka "+tax);
      }
      }
    }
  }
}

##10##Given number of courses, credits in each course and per credit cost, find how much a student have to pay for a particular semester.

/* time: 12:37pm
 * author: ani das
 * question: Given number of courses, credits in each course and per
 * credit cost, find how much a student
 * have to pay for a particular semester.*/
import java.util.Scanner;
public class Faraz10{ //original CostCalcSem
  public static void main (String [] args){
    int c=1, n=0, tcr=0, cr=0, cstPerCr=0, cst=0, tcst=0;
    Scanner input=new Scanner(System.in);
    System.out.println("Enter Your Course Number");
    n=input.nextInt();
    while(c<=n){
      System.out.println("Number of credits for course "+c);
      cr=input.nextInt();
      tcr=tcr+cr;
      System.out.println("Enter Cost per Credit");
      cstPerCr=input.nextInt();
      cst=cstPerCr*cr;
      tcst=tcst+cst;
      c=c+1;
    }System.out.println("Total Cost For This Semester is : "+tcst);
  }
}

To Read question and ans of 1-5 go here