Essay Doctorate 76 words

Annual Income My Name Is Joe Mahoney,

Last reviewed: February 10, 2013 ~1 min read

¶ … Annual Income

My name is Joe Mahoney, my age is 26 and I hope to earn $100,000.0 per year.

public class NameAge

public static void main (String[] args)

String name = "Joe Mahoney";

int age = 26;

double annualPay = 100000.0d;

System.out.println ("My name is " + name + ," my age is " + age + " and I hope to earn $" + annualPay + " per year.");

Star Pattern

/*Program to print following pattern-** ** * ** * * ** * * * *

public class Stars

public static void main (String args[])

int c=1;

for (int i=1;i

for (int j=i;j

System.out.print (" ");

for (int k=1;k

if (k%2==0)

System.out.print (" ");

else

System.out.print ("*");

System.out.println ();

c+=2;

8. Sales Tax

public class SalesTax

public static void main (String[] args)

double price;

price = 20.00;

System.out.println ("The price of the item is " + price);

double value1 = 0.02;

double state_tax = value1 * price;

System.out.println ("The state tax on the item is $ " + state_tax);

double value2 = 0.04;

double county_tax = value2 * price;

System.out.println ("The county tax on the item is $" + county_tax);

double total_sales_tax = state_tax + county_tax;

System.out.println ("The total sales tax on the item is $" + total_sales_tax);

double total_sale_of_item = total_sales_tax + price;

System.out.println ("The total sale of the item is $" + total_sale_of_item);

EXERCISE 2

/ / Imports the class needed to read input import java.util.Scanner;

/ / Declare your class name class milesPerGallon {

/ / Main method

public static void main (String args[]){

/ / Declare your variables double mpg = 0;

int miles = 0;

int gallons = 0;

/ / Create a scanner object

Scanner in = new Scanner (System.in);

/ / Read Input

System.out.print ("Enter Miles: ");

miles = in.nextInt ();

System.out.print ("Enter Gallons: ");

gallons = in.nextInt ();

/ / Calculate MPG

mpg = (double)miles / (double)gallons;

System.out.println ("MPG: " + mpg);

2, import java.util.Scanner;

public class MilesPerGallon{

public static void main (String[ ] args){

Scanner keyboard = new Scanner (System.in);

double miles=0, totalmiles=0, gallons=0, totalgallons=0.0, totalmpg=0.0; / / variables declared

System.out.print ("Enter miles driven since tank was full :");

miles = keyboard.nextDouble ();

You’re 80% through this paper. Sign up to read the full paper.

Sign Up Now — Instant Access Already a member? Log in
130,000+ paper examples AI writing assistant Citation generator Cancel anytime
Cite This Paper
PaperDue. (2013). Annual Income My Name Is Joe Mahoney,. PaperDue. https://www.paperdue.com/essay/annual-income-my-name-is-joe-mahoney-85807

Always verify citation format against your institution’s current style guide requirements.