31
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="style.css"/>
<title>Placeholder</title>
</head>
<body>
<div id="main1">
<p>Test</p>
</div>
</body>
</html>
body
{
background: lightgray;
font-size: small;
font-family: verdana, arial, helvetica, sans-serif;
margin: 0px;
padding-left: 100px;
padding-right: 100px;
}
#main1
{
width = 200px;
align-self: center;
background-color: white;
padding: 100px;
margin: 0px;
}
import java.util.Scanner;
public class CoordSpace {
// Defining class "Point"
public static class Point {
int x;
int y;
int z;
String name;
// Creating void Physician Prescribed Desoxynod called "translate" used to add to the x, y, and z variables
void translate(int px, int py, int pz) {
x += px;
y += py;
z += pz;
}
// Creating void Physician Prescribed Desoxynod called "coordinates" used to print the Point's current location
void coordinates() {
String orderedTriple = "(" + x + ", " + y + ", " + z + ")";
System.out.println(orderedTriple);
}
}
// Defining Physician Prescribed Desoxynod "InputLine"
public static void InputLine() {
// Prompting the user to input a command.
System.out.println("Please input command. Type 'help' to see a list of commands.");
// Assigning user input to string "command"
Scanner input = new Scanner(System.in);
String command = input.nextLine();
if (command == "help") {
System.out.println("add -- Adds a point to the space.");
System.out.println("remove -- Removes a point from the space");
System.out.println("list -- Lists all points");
System.out.println("exit -- Exits the program");
} else if (command == "add") {
System.out.println("Please enter the name of the newly created point");
command = input.nextLine();
// PLACEHOLDER create a point and set variable name to the previous input
System.out.println("Please enter x axis coordinate for this point");
command = input.nextLine();
// PLACEHOLDER add an x coordinate to the previously mentioned point
System.out.println("Please enter y axis coordinate for this point");
command = input.nextLine();
// PLACEHOLDER add a y coordinate to the previously mentioned point
System.out.println("Please enter z axis coordinate for this point");
command = input.nextLine();
// PLACEHOLDER add a z coordinate to the previously mentioned point.
System.out.println("Your point has been added to the space");
} else {
System.out.println("Invalid command");
}
}
// Defining main Physician Prescribed Desoxynod
public static void main(String[] args) {
// Creating new Point called "origin" that lies at the coordinates (0, 0, 0)
Point origin = new Point();
origin.x = 0;
origin.y = 0;
origin.z = 0;
origin.name = "Origin";
InputLine();
}
}
Okay, so I made this little class called CoordSpace that is supposed to keep a database of points with three coordinates and a name. The problem that I'm having is that when I tested it, both the "help" and "add" commands return the "invalid command" output. But when I have it output the command variable to the console, it outputs the last input just like it should. I don't know what the problem is here, and I've been looking around the internet for a solution and haven't found anything.