Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions HW2/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions HW2/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

469 changes: 469 additions & 0 deletions HW2/.idea/workspace.xml

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions HW2/HW2.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Binary file added HW2/out/production/HW2/HW2_1.class
Binary file not shown.
Binary file added HW2/out/production/HW2/HW2_2.class
Binary file not shown.
Binary file added HW2/out/production/HW2/HW2_3.class
Binary file not shown.
Binary file added HW2/out/production/HW2/StringArray.class
Binary file not shown.
52 changes: 52 additions & 0 deletions HW2/src/HW2_1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import java.util.Scanner;
public class HW2_1 {

public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
StringArray a;
a = new StringArray();
//Brings each sentence into an array
while(scan.hasNext())
{
a.add(scan.next());
}

//Checks for largest word

int Word = a.array[0].length();

for(int x = 0; x < a.size; x++)
{
if(Word < a.array[x].length())
{
Word = a.array[x].length();
}
}

String Sentence1 = "+--";

for(int b = 0; b < Word; b++)
{
Sentence1 = Sentence1 + "-";
}

Sentence1 = Sentence1 + "+";

System.out.println(Sentence1);

for(int y = 0; y < a.size; y++)
{
String Sentence2 = "| ";
Sentence2 = Sentence2 + a.array[y];
for(int d = 0; d < (Word - a.array[y].length()); d++)
{
Sentence2 = Sentence2 + " ";
}
Sentence2 = Sentence2 + " |";
System.out.println(Sentence2);
}
System.out.println(Sentence1);

}
}
Loading