Initial commit
This commit is contained in:
commit
9cc440b16d
38
.gitignore
vendored
Normal file
38
.gitignore
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
7
.idea/encodings.xml
generated
Normal file
7
.idea/encodings.xml
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
14
.idea/misc.xml
generated
Normal file
14
.idea/misc.xml
generated
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
17
pom.xml
Normal file
17
pom.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>homeWorkOne</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
25
src/main/java/divisibility/Divisibility.java
Normal file
25
src/main/java/divisibility/Divisibility.java
Normal file
@ -0,0 +1,25 @@
|
||||
package divisibility;
|
||||
|
||||
//This program reads in two numbers from the user, dividend and divisor, and prints out whether dividend is evenly divisible by divisor.
|
||||
//
|
||||
// For example, one run of the program may look like this:
|
||||
//
|
||||
//Enter the dividend: 10
|
||||
//Enter the divisor: 5
|
||||
//10 is divisible by 5!
|
||||
//
|
||||
//Because 5 goes into 10 twice. 10 is evenly divisible by 5.
|
||||
|
||||
//Your program should be able to produce the following output:
|
||||
//
|
||||
//Enter the dividend: 10
|
||||
//Enter the divisor: 0
|
||||
//10 is not divisible by 0
|
||||
|
||||
|
||||
public class Divisibility {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
26
src/main/java/dog/Dog.java
Normal file
26
src/main/java/dog/Dog.java
Normal file
@ -0,0 +1,26 @@
|
||||
package dog;
|
||||
//Here we have a class that represents a dog. Currently, the only instance variable (or field) is called breed. You can make a new Dog object by passing the breed to the constructor.
|
||||
//
|
||||
//Add an instance variable that is a String called name, which represents the dog’s name. Add the instance variable and also include it as the second parameter to the constructor.
|
||||
//
|
||||
//You should update the toString and the format should be: “[name] is a [breed]”
|
||||
//For example:
|
||||
//
|
||||
//Bluey is a Australian Cattle Dog
|
||||
//Test out your Dog class and the new toString method in DogTester.java
|
||||
|
||||
|
||||
public class Dog {
|
||||
private String breed;
|
||||
// Add an instance variable here for name.
|
||||
|
||||
public Dog(String theBreed)
|
||||
{
|
||||
breed = theBreed;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return breed;
|
||||
}
|
||||
}
|
||||
9
src/main/java/dog/DogTester.java
Normal file
9
src/main/java/dog/DogTester.java
Normal file
@ -0,0 +1,9 @@
|
||||
package dog;
|
||||
|
||||
public class DogTester {
|
||||
|
||||
public static void main(String[] args) {
|
||||
//Dog bluey = new Dog("Australian Cattle Dog, "Bluey");
|
||||
//System.out.println(bluey);
|
||||
}
|
||||
}
|
||||
20
src/main/java/factorial/Factorial.java
Normal file
20
src/main/java/factorial/Factorial.java
Normal file
@ -0,0 +1,20 @@
|
||||
package factorial;
|
||||
/*
|
||||
Write a program that prints a factorial to the screen.
|
||||
|
||||
The factorial of a number is found by multiplying itself by all positive integers less than it (excluding 0). For example, 4 factorial, written as 4!, can be computed as follows:
|
||||
|
||||
4! == 4 * 3 * 2 * 1 == 24
|
||||
After taking user input for the factorial they want to find, print out the factorial to the console.
|
||||
Remember to use a for loop! Java does not have a built in factorial operator.
|
||||
Example Output:
|
||||
What number would you like to compute the factorial for? 4
|
||||
24
|
||||
*/
|
||||
|
||||
public class Factorial {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
10
src/main/java/isDivisible/IsDivisible.java
Normal file
10
src/main/java/isDivisible/IsDivisible.java
Normal file
@ -0,0 +1,10 @@
|
||||
package isDivisible;
|
||||
|
||||
//Write a method that returns whether a is divisible by b.
|
||||
//
|
||||
//Your method signature should be
|
||||
//
|
||||
//public boolean isDivisible(int a, int b)
|
||||
|
||||
public class IsDivisible {
|
||||
}
|
||||
13
src/main/java/isInteger/IsInteger.java
Normal file
13
src/main/java/isInteger/IsInteger.java
Normal file
@ -0,0 +1,13 @@
|
||||
package isInteger;
|
||||
|
||||
public class IsInteger {
|
||||
|
||||
// Given a string, determine if it is an integer. For example the
|
||||
// string “123” is an integer, but the string “hello” is not.
|
||||
//
|
||||
// It is an integer if all of the characters in the string are digits.
|
||||
//
|
||||
// Return true if it is an integer, or false if it is not.
|
||||
//
|
||||
|
||||
}
|
||||
26
src/main/java/threeStrings/ThreeStrings.java
Normal file
26
src/main/java/threeStrings/ThreeStrings.java
Normal file
@ -0,0 +1,26 @@
|
||||
package threeStrings;
|
||||
//Write a program that asks the user for three strings.
|
||||
//
|
||||
//Then, print out whether the first string
|
||||
//concatenated to the second string is equal to the
|
||||
//third string. Here are a few sample program runs:
|
||||
//
|
||||
//Sample Program 1:
|
||||
//
|
||||
//First string? pepper
|
||||
//Second string? mint
|
||||
//Third string? peppermint
|
||||
//pepper + mint is equal to peppermint!
|
||||
//Sample Program 2:
|
||||
//
|
||||
//First string? go
|
||||
//Second string? fish
|
||||
//Third string? donuts
|
||||
//go + fish is not equal to donuts!
|
||||
|
||||
public class ThreeStrings {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user