Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Language: Java I am attempting to find a way to delete over 2,400 lines of a cer

ID: 3693258 • Letter: L

Question

Language: Java

I am attempting to find a way to delete over 2,400 lines of a certain code... I am trying to delete every line except for the bolded lines, please note that the bolded letters are not actually bolded in the file... I simply bolded them so that you can see which lines I want to keep. Remember each time this code occurs the values may be different. I WOULD LIKE THE FULL CLASS FILE READY TO RUN, I am going to be putting it into a folder and running through a batch file.

The file is called "itemdef.txt" it will be located in the same folder.

This is what the code looks like:

{
"id": 9,

"name": "Different Names",
"desc": "Different Descriptions.",
"value": different values,
"dropValue": 0,
"bonus": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"slot": -1,
"fullmask": false,
"stackable": true,
"noteable": true,
"tradable": true,
"wearable": false,
"showBeard": true,
"members": true,
"twoHanded": false,
"requirements": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]

},

Thank you very much :)

Explanation / Answer

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package class2400;
/**
*
* @author Admin
*/
public class Class2400 {
        int id = 9;
        String name = "Stella";
        int value = 101;
        int dropValue = -5;
        //int [] bonus = new int[30];
        int [] bonus = {0,0,0,0,0};
        int slot = -1;
        boolean fullmask = false;
        boolean stackable = true;
        boolean noteable = true;
        boolean tradable = true;
        boolean wearable = false;
        boolean showBeard = true;
        boolean members = true;      
        boolean twoHanded = false;      
        int [] requirements = {0,0,0,0,0,0,0,0,0,0,0,0 };
      
        void setter(int id1, String nm, int val, int dropVal, boolean fm, boolean stk, boolean nt, boolean trd, boolean wr, boolean sb, boolean mem, boolean th)    {
            id = id1;
            nm = name;
            value = val;
            dropValue = dropVal;
            fullmask = fm;
            stackable = stk;
            noteable = nt;
            tradable = trd;
            wearable = wr;
            showBeard = sb;
            members = mem;
            twoHanded = th;
        }
      
        void getter()    {
          
        }
      
        void alter()    {
            // this will swap values between true and false - vice versa
          
        }
      
      
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
      
      
      
        // instantiate class object
        Class2400 obj1 = new Class2400();
        //obj1.bonus=already assigned
        obj1.dropValue = -7;
        obj1.fullmask = true;
        obj1.id = 21;
        // swap members value between true and false
        if ( obj1.members == false ) obj1.members = true; else obj1.members = false;
      
      
              
      
      
      
      
      
      
        // and assign values
      
      
      
    } // end main
} // end class2400