Commit 6468d613 authored by MostafaRahmati's avatar MostafaRahmati

First Commit

parents
Pipeline #5934 canceled with stages
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/../../../../../../:\Users\Mostafa\Desktop\VotingSystem\.idea/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
<component name="libraryTable">
<library name="JalaliCalendar-1.3.1">
<CLASSES>
<root url="jar://E:/Uni/APWorkshop/Session 4/JalaliCalendar-1.3.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_15" default="true" project-jdk-name="openjdk-15" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/VotingSystem.iml" filepath="$PROJECT_DIR$/VotingSystem.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
<?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="library" name="JalaliCalendar-1.3.1" level="project" />
</component>
</module>
\ No newline at end of file
public class Main {
public static void main(String[] args) {
}
}
public class Person {
private String firstName;
private String lastName;
public Person(String firstName, String lastName){
this.firstName=firstName;
this.lastName=lastName;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
@Override
public String toString() {
return firstName+" "+lastName;
}
}
import ir.huri.jcal.JalaliCalendar;
import java.util.Objects;
public class Vote {
private Person person;
private JalaliCalendar date;
public Vote(Person person, JalaliCalendar date) {
this.date = date;
this.person = person;
}
public Person getPerson() {
return person;
}
public JalaliCalendar getDate() {
return date;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Vote vote = (Vote) o;
return getPerson().equals(vote.getPerson()) && getDate().equals(vote.getDate());
}
@Override
public int hashCode() {
return Objects.hash(getPerson(), getDate());
}
}
public class Voting {
private int type;
private String question;
}
import java.util.ArrayList;
import java.util.HashSet;
public class VotingSystem {
private int type;
private String question;
private ArrayList<Voting> votingList;
public VotingSystem() {
this.votingList = new ArrayList<>();
}
public Voting createVoting(int type, String question, ArrayList<String> optionsList) {
HashSet<String> optionsSet = new HashSet<String>(optionsList);
Voting voting = new Voting(type, question, optionsSet);
this.votingList.add(voting);
return voting;
this.type = type;
this.question = question;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment