John Delmark Aguilar
Would you like to react to this message? Create an account in a few clicks or log in to continue.
John Delmark Aguilar

Personal Forum
 
HomeSearchLatest imagesRegisterLog in

 

 Mutator & Assesor

Go down 
AuthorMessage
dElmARk
Admin
Admin
dElmARk


Posts : 92
Join date : 09/04/2012

Mutator & Assesor Empty
PostSubject: Mutator & Assesor   Mutator & Assesor Icon_minitimeTue Oct 23, 2012 9:14 pm

startma.java
Code:
import java.util.Scanner;
public class startma{
    public static void main(String[]args){
    Scanner xx = new Scanner(System.in);
          ma ss = new ma();
    System.out.print("Enter the name of yor GF: ");
    String gfName = xx.nextLine();
    ss.setName(gfName);
    ss.sayName();}
}
class ma
Code:

public class ma{
    String girlFriend;
    void setName(String name){
          girlFriend = name;}
    String getName(){
          return girlFriend;}
    void sayName(){
          System.out.println("Your first girlfriend is " +  girlFriend);}
}



startData.java
Code:
import java.util.*;
public class startData{
    public static void main(String[]args){
    Scanner xx = new Scanner(System.in);
    Data lol = new Data();
    System.out.print("Input x");
    int x = xx.nextInt();
    System.out.print("Input y");
    int y = xx.nextInt();
    System.out.print("Input z");
    int z = xx.nextInt();

    System.out.println(lol.add(x));
    System.out.println(lol.add(x, y));
    System.out.println(lol.add(x, y, z));
    }
}
Data.java
Code:

class Data{
int x, y;
    public int add(int x){
          return x+5;}
    public int add(int x, int y){
          return x+y;}
    public int add(int x, int y, int z){
          return x+y+z;
    }
}
Back to top Go down
https://delmark.forumtl.com
dElmARk
Admin
Admin
dElmARk


Posts : 92
Join date : 09/04/2012

Mutator & Assesor Empty
PostSubject: Re: Mutator & Assesor   Mutator & Assesor Icon_minitimeTue Oct 23, 2012 9:17 pm

StartEmployee.java
Code:
public class StartEmployee{
    public static void main(String []args){
          Employee del= new Employee();
          del.ln="Aguilar";
          del.Fn="John Delmark";
          del.Dept="Information Technology";
          del.pos="P.R.O";
          del.age= 16;
          System.out.println("Employee FName: "+ del.ln+"\nEmployee LName: "+ del.Fn+"\nDepartment: "+ del.Dept+"\nPosition: "+ del.pos+"\nAge: "+ del.age);

    }
}

Employee.java

Code:
public class Employee{
    String ln, Fn, Dept, pos;
    int age;
   
    public static void doWork(){
        System.out.println("Programming");
    }
    public String doBreak(){
        return "Eating";
    }
    public void doRest(){
        System.out.println("Resting at the park");
    }
    public int getWage(){
        return 1000;
    }
}
Back to top Go down
https://delmark.forumtl.com
dElmARk
Admin
Admin
dElmARk


Posts : 92
Join date : 09/04/2012

Mutator & Assesor Empty
PostSubject: Re: Mutator & Assesor   Mutator & Assesor Icon_minitimeTue Oct 23, 2012 9:28 pm

Code:
import java.util.*;
public class Cashier
{
double cost;
double tax;
double payment;
public static void main(String[] args)
{
 Cashier app = new Cashier();
 Scanner input = new Scanner(System.in);
 System.out.println("Please enter item cost: ");
 String i = input.nextLine();
 app.setCost(Double.parseDouble(i));
 System.out.println("The original cost of the item is: " +app.getCost());
 System.out.println("The 6% sales tax of the item is: ");
 app.setTax(app.getCost() * 0.06);
 System.out.println("The total cost of the item is: " +(app.getCost() + app.getTax()));
 System.out.println("Enter the amount paid by the costumer: ");
 i = input.nextLine();
 app.setPayment(Double.parseDouble(i));
 if(app.getPayment() < app.getCost()+app.getTax())
 {
 System.out.println("Your payment is not enough");
 }
 else
 {
 double change = app.getPayment() - (app.getCost()+app.getTax());
 System.out.println("Your change is: " + change);
 }
}
double getCost()
{
  return cost;
}
double getTax()
{
  return tax;
}
double getPayment()
{
  return payment;
}
void setCost(double cost)
{
  this.cost= cost;
}
void setTax(double taxRate)
{
  tax=taxRate;
  System.out.println(tax);
}
void setPayment(double payment)
{
  this.payment = payment;
}
}
 
Back to top Go down
https://delmark.forumtl.com
Sponsored content





Mutator & Assesor Empty
PostSubject: Re: Mutator & Assesor   Mutator & Assesor Icon_minitime

Back to top Go down
 
Mutator & Assesor
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
John Delmark Aguilar :: dElmARk Productions :: Java Programs :: Tutorials-
Jump to: