Initial Commit

This commit is contained in:
2022-10-07 00:22:46 -03:00
commit bdcf6d3e1c
465 changed files with 15466 additions and 0 deletions

8
Source Code/Assignment7Q2/.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/../../../../../../:\ProgrammingProjects\JavaProjects\JavaYear1\Assignment7Q2\.idea/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

View File

@ -0,0 +1,25 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
<package name="java.util" alias="false" withSubpackages="false" />
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
<package name="io.ktor" alias="false" withSubpackages="true" />
</value>
</option>
<option name="PACKAGES_IMPORT_LAYOUT">
<value>
<package name="" alias="false" withSubpackages="true" />
<package name="java" alias="false" withSubpackages="true" />
<package name="javax" alias="false" withSubpackages="true" />
<package name="kotlin" alias="false" withSubpackages="true" />
<package name="" alias="true" withSubpackages="true" />
</value>
</option>
</JetCodeStyleSettings>
<ScalaCodeStyleSettings>
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
</ScalaCodeStyleSettings>
</code_scheme>
</component>

View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

View File

@ -0,0 +1 @@
<html>Simple <b>Java</b> application that includes a class with <code>main()</code> method</html>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT" />
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectKey">
<option name="state" value="project://e2804f05-5315-4fc6-a121-c522a6c26470" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Assignment7Q2.iml" filepath="$PROJECT_DIR$/Assignment7Q2.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,3 @@
<template>
<input-field default="com.company">IJ_BASE_PACKAGE</input-field>
</template>

View File

@ -0,0 +1,20 @@
<?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" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/19.0.0/annotations-19.0.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>

View File

@ -0,0 +1,46 @@
/**
* This class has two methods, one for returning a constructed string from the hieroglyph and one that drives the console input and output
* @author Isaac Shoebottom (3429069)
*/
public class Main {
public static void main(String[] args) {
java.util.Scanner scan = new java.util.Scanner(System.in);
int inputNumber;
do {
System.out.print("Please enter a number between 1 and 9 999 999: ");
inputNumber = scan.nextInt();
if (inputNumber < 1 | inputNumber > 9_999_999) {
System.out.println("Invalid input. You must enter a number between 1 and 9 999 999");
}
} while (inputNumber < 1 | inputNumber > 9_999_999);
System.out.println(inputNumber + " in Egyptian hieroglyphs is:");
System.out.print(printHieroglyphics(inputNumber/1_000_000, 'w')); inputNumber %= 1_000_000;
System.out.print(printHieroglyphics(inputNumber/100_000, '&')); inputNumber %= 100_000;
System.out.print(printHieroglyphics(inputNumber/10_000, ')')); inputNumber %= 10_000;
System.out.print(printHieroglyphics(inputNumber/1_000, '*')); inputNumber %= 1_000;
System.out.print(printHieroglyphics(inputNumber/100, '@')); inputNumber %= 100;
System.out.print(printHieroglyphics(inputNumber/10, 'n')); inputNumber %= 10;
System.out.print(printHieroglyphics(inputNumber, '|'));
}
private static String printHieroglyphics(int number, char hieroglyph) {
if (number == 0 ) { return ""; }
byte counter = 0;
StringBuilder phrase = new StringBuilder(String.valueOf(hieroglyph));
if (number == 4 | number == 7 | number == 8) {
for (int i = number; i > 1; i--) {
counter++;
if (counter % 4 == 0) { phrase.append("\n"); }
phrase.append(hieroglyph);
}
} else {
for (int i = number; i > 1; i--) {
counter++;
if (counter % 3 == 0) { phrase.append("\n"); }
phrase.append(hieroglyph);
}
}
return (phrase.toString() + "\n");
}
}