java rewrite the following program without import javautilSt

java rewrite the following program without import java.util.StringTokenizer;

https://www.chegg.com/homework-help/visit-wwwmyprogramminglabcom-complete-select-exercises-onlin-chapter-7-problem-9pp-solution-9780132855778-exc

i think it can be simpler because

http://www.chegg.com/homework-help/first-complete-programming-project-1modify-main-method-loop-chapter-5-problem-10pp-solution-9780134243931-exc doesn\'t use that class thing

but i need it for this program: https://www.chegg.com/homework-help/visit-wwwmyprogramminglabcom-complete-select-exercises-onlin-chapter-7-problem-9pp-solution-9780132855778-exc

Solution

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class Produce {

   String name;
   int type;
   public Produce(String name, int type) {
      
       this.name=name;
       this.type=type;
   }
  
   public String setName(String name){
      
       return name;
   }

   public int setName(int type){
      
       return type;
   }

  
}

class Fruit extends Produce {

   public Fruit(String name, int type) {
      
       super(name, type);
   }

}

class Vegetable extends Fruit {

   public Vegetable(String name, int type) {
      
       super(name, type);
   }

}

class BoxOfProduce extends Fruit{

   public BoxOfProduce(String name, int type) {
       super(name, type);
      
   }

   String[] str;
  
   public void add(Produce produce) {
  
   }

   public String toString() {
      
       return name;
      
   }
}
class TesterClass{
  
  
   public static void main(String[] args) throws IOException {
      
       File f=new File(\"E://java/fruit.txt\");//make file path according to your system
       //Create file with name fruit.txt
       FileWriter fw =new FileWriter(\"E://java/fruit.txt\");
       BufferedWriter bw=new BufferedWriter(fw);
      
       bw.write(\"Pass value which you want to enter in file\");
      
       FileReader fr = new FileReader(\"E://java/fruit.txt\");
       BufferedReader br=new BufferedReader(fr);
       br.read();//enter char which you want to read from file
      
       bw.flush();
       bw.close();
       br.close();
      
   }

  
}

java rewrite the following program without import java.util.StringTokenizer; https://www.chegg.com/homework-help/visit-wwwmyprogramminglabcom-complete-select-ex
java rewrite the following program without import java.util.StringTokenizer; https://www.chegg.com/homework-help/visit-wwwmyprogramminglabcom-complete-select-ex

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site