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

I need help with java programming, i am completely lost. how do you start? We al

ID: 3527399 • Letter: I

Question

I need help with java programming, i am completely lost. how do you start? We already have other java files from our previous labs, i THINK, we need to call some of the methods, but i dont know how. In this case i have to make methods for run(), cycle(), fetch(), increment() and execute(). Please help. /** * The run method should perform the loadMemory() operation and begin * cycling through the fetch, increment, execute cycle by calling the * cycle() method. */ void run(); /** * The cycle method should first create a boolean variable to use * in determining the stop condition. Using a while loop, you can then * loop on the fetch() increment() and execute() methods. Note that * the execute method returns a boolean, this is how you determine * if the loop should terminate. */ void cycle(); /** * The fetch method retrieves the value stored in memory at the location * given by the program counter, and stores this value in the instruction * register. */ void fetch(); /** * The increment method increments the value of the program counter. * THINK: you already have a method that does this. */ void increment(); /** * The execute method converts the opcode stored in the instruction * register to the code that corresponds to this instruction number. * See the above defined final static ints for further explanation * of each instruction. If you remember switch statements from * last semester, one might come in handy now. * * Note that we return a boolean from this method. This boolean is * used in our cycle method to determine when to end the loop. * When do we end the loop? When the STOP instruction is thrown of * course! * @return boolean endLoopCondition */ boolean execute();

Explanation / Answer

Ok below is the full code I have written for what is suppose to be my own BigInteger class in java, I rather use what is there already but the professor wants this. Thing is I have it making a BigInt and then store the data as an int[] and the sign as 1 for positive and -1 for negative. From there I am suppose to add, subtract, and multiply the numbers when asked. This would be fine if it was a typical type int, long, etc, but as the numbers are in an array now, I need to find a way to to these methods. I have tried many ways, as you can see, and things like add are fine when both numbers are positive or negative, but when mixed, I am not getting it. What I need help with is not idea of how to do each type, I know methods, lattice multiplication etc, but I need to know the psuedocode for how I would do this stuff, I am completely lost. By the way I know I have asked for similar things here and there for each method, sorry I am still not getting it, and it is due in a couple of days, and I have racked my brain all weekend. package BigInteger; public class BigInt{ private int[] store; private int sign; public BigInt(){ store = new int[10]; sign = 1; } public BigInt(int[] data){ store = data; } public BigInt(int data, int maxSize){ int size = String.valueOf(data).length(); if (maxSize == 0){ store = new int[size]; } else if(size >= maxSize){ store = new int[size]; } else{ store = new int[maxSize]; } if (data > 0){ sign = 1; }else{ sign = -1; } for(int i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote