Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Oct 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    why i cant delete and to see my overview.!

    PHP Code:
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */

    /**
     *
     * @author FritzEam
     */

        
    import java.util.*;

    public class 
    Dubg {
    public static 
    Scanner input = new Scanner(System.in);
    public static 
    int[] code = new int[10];
    public static 
    String[] name = new String[30];
    public static 
    int[] qty = new int[10];
    public static 
    double[] price = new double[10];

    public static 
    int[] pcode = {11121122113311441155};
    public static 
    String[] pname = {"Comics""Horror Book""Novel""Nature""Magazine"};
    public static 
    int[] nqty = {101515510};
    public static 
    double[] nprice = {49.9979.9959.99109.9959.99};

    public static 
    int jsrp 0mnnumnwqty=0trans=0;

    public static 
    double total 0tot 0change 0nwprice=0;
    public static 
    boolean c false;
        


    public static 
    void main(String[] args){

    CountItems();
    for ( 
    int z 05z++ ) {
    code[z] = pcode[z];
    name[z] = pname[z];
    qty[z] = nqty[z];
    price[z] = nprice[z];
    }    

    while(
    ) {
    System.out.println("\n1. ADD ITEMS ");
    System.out.println("2. VIEW ITEMS ");
    System.out.println("3. SEARCH ITEMS ");
    System.out.println("4. MODIFY ITEMS ");
    System.out.println("5. DELETE ITEMS ");
    System.out.println("6. PROCESS TRANSACTION ");
    System.out.println("7. SALES OVERVIEW ");
    System.out.println("8. EXIT ");

    System.out.print("Enter number of your choice: ");
    input.nextInt();

    System.out.println();

    switch(
    j) {

    case 
    1System.out.println("---ADD RECORDS---"); add(); break;
    case 
    2System.out.println("---VIEW RECORDS---"); view(); break;
    case 
    3System.out.println("---SEARCH RECORDS---"); search(); break;
    case 
    4System.out.println("---MODIFY RECORDS---"); modify(); break;
    case 
    5System.out.println("---DELETE---"); delete(); break;
    case 
    6System.out.println("---PROCESS TRANSACTION---"); transaction(); break;
    case 
    7System.out.println("---SALES OVERVIEW---"); overview(); break;
    case 
    8System.out.println("END APPLICATION"); break;
    }
    }    
    }

    public static 
    void CountItems() {
    srp=0;

    for ( 
    int z 010z++ ) {
    if ( !(
    name[z] == null)) {
    srp++;
    }
    }
    }

    public static 
    void add(){
    CountItems();
    /*System.out.print("Enter number of data to be entered: ");
    num = input.nextInt();

    for(int a = 0; a < num; a++) {*/

    System.out.print(" Enter Product Code: "); code[srp] = input.nextInt();    
    System.out.print(" Enter Product Name: "); name[srp] = input.next();    
    System.out.print(" Enter Quantity: "); qty[srp] = input.nextInt();    
    System.out.print(" Enter Price: "); price[srp] = input.nextInt();    

    }    
    //}

    public static void view(){
    CountItems();
    for(
    int i 0srpi++) {
    System.out.println("\n Product Code: " code[i] + " \n Product Name: " name[i] + 
    "\n Quantity: " qty[i] + "\n Price: " price[i]); 
    }    
    }

    public static 
    void search(){
    System.out.print("Enter Product Code: ");
    int search input.nextInt();    

    for(
    int a 0srpa++) { 
    if(
    search == (code[a])) 
    {
    System.out.println("\n Product Code: " code[a] + " \n Product Name: " name[a] + "\n Quantity: " qty[a] + 
    "\n Price: " price[a]);
    true;
    }
    }
    if(
    == falseSystem.out.println("NO BOOK FOUND!"); 
    }

    public static 
    void modify(){
    System.out.print("\nEnter Product Code: ");
    int mod input.nextInt();

    for (
    int a 0srpa++ ) {
    if ( 
    mod == (code[a])) {
    System.out.print("\nEnter a new Product Name : "); name[a] = input.next();
    System.out.print("Enter a new Price : "); price[a] = input.nextInt();

    System.out.println("SAVE CHANGES!!!");
    true;
    }
    }
    if ( 
    == false System.out.println("CANNOT BE FOUND!");
    }

    public static 
    void delete(){

    String s" "unknown" " 

    System.out.print("\nEnter Product Name: "); s=input.next();


    for(
    int a 010a++){
    if(
    s.equalsIgnoreCase(name[a])){
    code[a] = 0;
    name[a] = unknown;
    price[a] = 0.0;
    qty[a] =  ;

    System.out.println("ITEM DELETED!!!");
    true;
    }
    }
    if(
    == false)
    System.out.println("CANNOT BE FOUND!");
    }

    public static 
    void transaction(){
    System.out.print("\nEnter No. of Items to Buy: ");
    trans input.nextInt();

    for(
    int a 0transa++) {
    System.out.print("Enter code "+(a+1)+": "); input.nextInt();
    System.out.print("Enter quantity: "); input.nextInt();

    for (
    int i 0srpi++) {
    if ( 
    == code[i] ) {
    total += (price[i] * n);
    }
    }    
    }

    System.out.println("\nTotal Payable: ""Php" total);

    System.out.print("Enter cash: ");
    int mon input.nextInt();

    change mon total;

    if(
    mon>=total)
    System.out.println("Change: " "Php" change);
    else
    System.out.println("YOUR MONEY IS NOT ENOUGH!!!");
    }

    public static 
    void overview(){

    for (
    int i 0srpi++) {

    nwqty qty[i] - n;
    nwprice price[i] * qty[i];


    System.out.print("\n\nProduct Code: " code[i]);
    System.out.print("\nProduct Name: " name[i]);
    System.out.print("\nQuantity: " nwqty);
    System.out.println("\nTotal Price: " nwprice);
    }
    }

    Last edited by VIPStephan; 10-09-2012 at 07:39 PM. Reason: added code BB tags


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •