Here's my lab thus far:
import java.util.Scanner;
public class Arithmetic
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
int Fi, Si, Ti, Ff, Ss, Sss, Ei;
double Fd, Sd, Td, Ffd, Ffdd, Ssd, Ssdd;
System.out.println("Enter the first integer.");
Fi = keyboard.nextInt();
System.out.println("Enter the second integer.");
Si = keyboard.nextInt();
Ti = Fi + Si;
Ff = Fi - Si;
Ss = Fi * Si;
Sss = Fi / Si;
Ei = Fi % Si;
System.out.println("When added, these two integers equal" + Ti);
System.out.println("When subtracted, these two integers equal" + Ff);
System.out.println("When multiplied, these two integers equal" + Ss);
System.out.println("When divided, these two integers equal" + Sss);
System.out.println("When modulated, these two integers equal" + Ei);
System.out.println("Now, enter a real number.");
Fd = keyboard.nextDouble();
System.out.println("Now, enter another real number.");
Sd = keyboard.nextDouble();
Td = Fd + Sd;
Ffd = Fd - Sd;
Ffdd = Fd * Sd;
Ssd = Fd / Sd;
Ssdd = Fd % Sd;
System.out.println("When added, these two real numbers equal" + Td);
System.out.println("When subtracted, these two real numbers equal" + Ffd)
System.out.println("Multiplied, these two real numbers equal" + Ffdd);
System.out.println("Divided, these two real numbers equal" + Ssd);
System.out.println("Modulated, these two real numbers equal" + Ssdd);
this is the part that I am stuck on:
# Input a text string, output its length; input an index within the string, and output the character at that position in the string; input another text string, and output the location of the first occurrence of the second string in the first one (if such location exists, otherwise output -1);
# Finally, input a date (a text string) in the format mm/dd/yyyy (i.e., two digits for the month, followed by a '/', followed by two digits for the day, followed by a '/', followed by four digits for the year), and output it in the common European format dd-mm-yyyy (i.e., two digits for the day, followed by a '-', followed by two digits for the month, followed by a '-', followed by four digits for the year.
edit: I realize this might look like a lot more work, but hey, it's a start. I'll learn how to make it smaller eventually.
edit 2: Okay, I just ran this program and it works. But, something is wrong. The spacing is a bit iffy at the end of my sentences. There is no spacing in between equal and the final result of that operation. I'm not sure what's going on or how to fix it. Do I need to start a new line?