/**
* Loads the given values into the machine's memory. If the length
of the
* given array is smaller than this machine's memory size, the
remaining
* cells are filled with zeros; if larger, extra values are ignored.
If
* any value is encountered in the given array that is not between
-9999
* and 9999, the machine crashes at that point with message "***
Invalid
* input ***". The machine's memory size is not modified. If no
invalid
* inputs are encountered, the machine will be in a non-halted
state.
* @param image
* memory image to load
*/
@Specified
public void loadMemoryImage(int[] image)
{
public void loadMemoryImage(int[] image)
{
if(image.length >=
this.memoryImage.length)
{
for (int i = 0; i <
this.memoryImage.length; i++)
{
if(image[i]>=-9999 && image[i]<=9999){
memoryImage[i] = image[i];
}
else
{
System.out.println("*** Invalid
input***");
dumpCore();
isHalted = true;
break;
}
}
}
else
{
for (int i = 0; i <
image.length; i++)
{
if(image[i]>=-9999 && image[i]<=9999)
{
memoryImage[i] = image[i];
}
else
{
System.out.println("*** Invalid
input***");
dumpCore();
isHalted = true;
break;
}
}
for (int i =
image.length; i < this.memoryImage.length; i++)
{
this.memoryImage[i] = 0;
}
}
isHalted = false;
}
/** * Loads the given values into the machine's memory. If the length of the *...
Given java code is below, please use it!
import java.util.Scanner;
public class LA2a {
/**
* Number of digits in a valid value sequence
*/
public static final int SEQ_DIGITS = 10;
/**
* Error for an invalid sequence
* (not correct number of characters
* or not made only of digits)
*/
public static final String ERR_SEQ = "Invalid
sequence";
/**
* Error for...
import javax.swing.*; import java.awt.*; import java.util.List; import java.util.*; /** * Canvas is a class to allow for simple graphical drawing on a canvas. * This is a modification of the general purpose Canvas, specially made for * the BlueJ "shapes" example. * * @author: Bruce Quig * @author: Michael Kolling (mik) * Minor changes to canvas dimensions by William Smith 6/4/2012 * * @version: 1.6 (shapes) */ public class Canvas { // Note: The implementation of this class (specifically the...
import javax.swing.*; import java.awt.*; import java.util.List; import java.util.*; /** * Canvas is a class to allow for simple graphical drawing on a canvas. * This is a modification of the general purpose Canvas, specially made for * the BlueJ "shapes" example. * * @author: Bruce Quig * @author: Michael Kolling (mik) * Minor changes to canvas dimensions by William Smith 6/4/2012 * * @version: 1.6 (shapes) */ public class Canvas { // Note: The implementation of this class (specifically the...
import java.util.Arrays; import java.util.Random; import java.util.Scanner; /** * TODO Write a summary of the role of this class in the * MasterMind program. * * @author TODO add your name here */ public class MasterMind { /** * Prompts the user for a value by displaying prompt. * Note: This method should not add a new line to the output of prompt. * * After prompting the user, the method will consume an entire * line of input while reading...
Need this in C
The starter code is long, if you know how to do it in other way
please do.
Do the best you can please.
Here's
the starter code:
//
-----------------------------------------------------------------------
// monsterdb.c
//
-----------------------------------------------------------------------
#include
#include
#include
//
-----------------------------------------------------------------------
// Some defines
#define NAME_MAX 64
#define BUFFER_MAX 256
//
-----------------------------------------------------------------------
// Structs
typedef struct
{
char name[NAME_MAX];
int hp;
int attackPower;
int armor;
} Character;
typedef struct
{
int size;
Character *list;
} CharacterContainer;
//
-----------------------------------------------------------------------
//...
Don't attempt if you can't attempt fully, i will dislike and negative comments would be given Please it's a request. c++ We will read a CSV files of a data dump from the GoodReads 2 web site that contains information about user-rated books (e.g., book titnle, publication year, ISBN number, average reader rating, and cover image URL). The information will be stored and some simple statistics will be calculated. Additionally, for extra credit, the program will create an HTML web...
IN JAVA Overview In this project you will implement a Java program that will print several shapes and patterns according to uses input. This program will allow the use to select the type (say, rectangle, triangle, or diamond), the size and the fill character for a shape. All operations will be performed based on the user input which will respond to a dynamic menu that will be presented. Specifically, the menu will guide the user to decide between different forms...
MATLAB help!
I have some MATLAB Assignment to do, the proffesor requires
all the small parts in order to get full credit. Help me out, thank
you
f LAB SECTION NAME HW6P3 (30 points) following are infinite series representations of the function, un pra i a script file HW6P3 that determines the value of the function from the sum of the series for a given value of x. The program (1 pt) must prompt the user to enter a value...
Hello Guys. I need help with this its in java In this project you will implement a Java program that will print several shapes and patterns according to uses input. This program will allow the use to select the type (say, rectangle, triangle, or diamond), the size and the fill character for a shape. All operations will be performed based on the user input which will respond to a dynamic menu that will be presented. Specifically, the menu will guide...
This wont take you more than 15 mins. Comple the two method and besure to test with Junit test that provided below. toArray() -- this method returns a newly allocated array containing the elements in the multiset. The array this method returns must only contain the elements in the multiset and not any nulls or other values that are stored in the backing store, but are not in the multiset. fromArray(E[] arr) -- this method updates the multiset so that...