Commit 44fb8c9b authored by amirhasan's avatar amirhasan

the final

parent e4b85bb3
......@@ -2,15 +2,7 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="67bfc981-7b10-4bf4-963c-b8f3544bb91a" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/untitled/Shop$1.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/untitled/Shop$Customer.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/untitled/Shop$Discount.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/untitled/Shop$Good.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/untitled/Shop$Order.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/untitled/Shop$Repository.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/untitled/Shop.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/Shop.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Shop.java" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/out/" />
......@@ -28,18 +20,20 @@
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/Shop.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="653">
<caret line="388" column="5" lean-forward="true" selection-start-line="388" selection-start-column="5" selection-end-line="388" selection-end-column="5" />
<state relative-caret-position="338">
<caret line="395" column="21" lean-forward="true" selection-start-line="395" selection-start-column="21" selection-end-line="395" selection-end-column="21" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#163#173#0" expanded="true" />
<element signature="e#319#325#0" expanded="true" />
<element signature="e#380#387#0" expanded="true" />
<element signature="method#increamentGood#0;class#Shop#0" />
<element signature="e#3278#3279#0" expanded="true" />
<element signature="e#3360#3361#0" expanded="true" />
<element signature="class#Customer#0;class#Repository#0;class#Shop#0" />
<element signature="class#Order#0;class#Repository#0;class#Shop#0" />
<element signature="class#SortbyFreeCapacity#0;class#Shop#0" />
<element signature="class#Repository#0;class#Shop#0" />
<element signature="class#Good#0;class#Shop#0" />
<element signature="class#Customer#0;class#Shop#0" />
<element signature="class#Order#0;class#Shop#0" />
<element signature="e#6258#6259#0" expanded="true" />
<element signature="e#6280#6281#0" expanded="true" />
<element signature="e#6310#6311#0" expanded="true" />
<element signature="e#6336#6337#0" expanded="true" />
</folding>
</state>
</provider>
......@@ -75,14 +69,29 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane" />
<pane id="PackagesPane" />
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="hw-3" type="b2602c69:ProjectViewProjectNode" />
<item name="hw-3" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="hw-3" type="b2602c69:ProjectViewProjectNode" />
<item name="hw-3" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1555002746370" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1555011101233" />
<property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" />
......@@ -99,7 +108,7 @@
</list>
</option>
</component>
<component name="RunManager">
<component name="RunManager" selected="Application.Shop">
<configuration name="Main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="sun.rmi.rmic.Main" />
<module name="untitled" />
......@@ -107,8 +116,16 @@
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="Shop" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Shop" />
<module name="untitled" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.Shop" />
<item itemvalue="Application.Main" />
</list>
</recent_temporary>
......@@ -145,10 +162,10 @@
<window_info id="Capture Tool" order="3" />
<window_info id="Favorites" order="4" side_tool="true" />
<window_info id="Structure" order="5" side_tool="true" weight="0.25" />
<window_info active="true" content_ui="combo" id="Project" order="6" visible="true" weight="0.02347919" />
<window_info content_ui="combo" id="Project" order="6" visible="true" weight="0.09284952" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" weight="0.3286119" />
<window_info anchor="bottom" id="Run" order="2" weight="0.28045326" />
<window_info anchor="bottom" id="Run" order="2" weight="0.27953216" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
......@@ -168,20 +185,25 @@
</layout>
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/my Questions about some part of pro.txt">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/src/Shop.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="653">
<caret line="388" column="5" lean-forward="true" selection-start-line="388" selection-start-column="5" selection-end-line="388" selection-end-column="5" />
<state relative-caret-position="338">
<caret line="395" column="21" lean-forward="true" selection-start-line="395" selection-start-column="21" selection-end-line="395" selection-end-column="21" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#163#173#0" expanded="true" />
<element signature="e#319#325#0" expanded="true" />
<element signature="e#380#387#0" expanded="true" />
<element signature="method#increamentGood#0;class#Shop#0" />
<element signature="e#3278#3279#0" expanded="true" />
<element signature="e#3360#3361#0" expanded="true" />
<element signature="class#Customer#0;class#Repository#0;class#Shop#0" />
<element signature="class#Order#0;class#Repository#0;class#Shop#0" />
<element signature="class#SortbyFreeCapacity#0;class#Shop#0" />
<element signature="class#Repository#0;class#Shop#0" />
<element signature="class#Good#0;class#Shop#0" />
<element signature="class#Customer#0;class#Shop#0" />
<element signature="class#Order#0;class#Shop#0" />
<element signature="e#6258#6259#0" expanded="true" />
<element signature="e#6280#6281#0" expanded="true" />
<element signature="e#6310#6311#0" expanded="true" />
<element signature="e#6336#6337#0" expanded="true" />
</folding>
</state>
</provider>
......
......@@ -27,7 +27,7 @@ public class Shop {
{
int d= Repositorys.size();
Goods.add(good);
Repository arr [ ] = new Repository[d];
for (int i = 0; i < d; i++) {
......@@ -115,6 +115,7 @@ static class Repository{
{ return (capacity -filledCapacity);}
}
static class Good{
private int id;
private int price ;
......@@ -133,6 +134,7 @@ static class Repository{
{ return name;}
}
static class Customer{
private String name;
......@@ -142,7 +144,7 @@ static class Repository{
ArrayList <Order> pendingOrders = new ArrayList<Order>();
public Customer (String name ,int id)
{ this.name = name;
ID = id;
this.ID = id;
}
public int getID(){return ID;}
public String getName () {return name;}
......@@ -165,6 +167,7 @@ static class Repository{
}
static class Order{
private int ID;
private String status;
......@@ -200,9 +203,9 @@ static class Repository{
int Newamount = Oldamount + amount;
Items.replace(good, Oldamount, Newamount);
}
else {
else
Items.put(good , amount);
}
}
public void removeItem(Good good)
......@@ -220,7 +223,8 @@ static class Repository{
}
public class Discount{
static class Discount{
//todo to compelete Discount class;
private int id;
private int percent;
......@@ -229,6 +233,14 @@ static class Repository{
this.id = id;
this.percent = percent;
}
public int getId()
{
return id;
}
public int getPercent()
{
return percent;
}
public void setOrder( Order order)
{
......@@ -316,28 +328,38 @@ static class Repository{
int idOfOrder = scan.nextInt();
int IdOfGood = scan.nextInt();
int NumberOfGood = scan.nextInt();
Good newgood = null;
for (Good good : MyShop.Goods) if( good.getId() == IdOfGood )
{
newgood = good;
break;
}
for(Order order : MyShop.orders){
if(order.getID() == idOfOrder)
{
for (Good good : order.getItems().keySet())
{
if (good.getId() == IdOfGood)
{
int oldNuberOfGood = order.getItems().get(good);
order.getItems().replace(good, oldNuberOfGood ,oldNuberOfGood+NumberOfGood);
order.addItem(newgood,NumberOfGood);
}
else {
order.Items.put(good,NumberOfGood);
}
}
if( add.equals("discount"))
{
int IdOfDiscount = scan.nextInt();
int Percent= scan.nextInt();
Discount discount = new Discount(IdOfDiscount,Percent);
}
}
}}
if(entering.equals("report"))
{
// except customers others are complete;
......@@ -351,12 +373,17 @@ static class Repository{
if(report.equals("income")){
System.out.println(MyShop.getIncome());
}
if(report.equals("customers"));/*
//todo about custromers
if(report.equals("customers"));
{
for (Customer customer : MyShop.Customers){
System.out.println(customer.getID()+","+customer.getName()+","+customer.getBalance()+",");
}}*/
for (Customer customer : MyShop.Customers)
{
int total = customer.getTOtalOrder().size();
int pending = customer.getPendingOrders().size();
int submit = total - pending;
System.out.println(customer.getID()+","+customer.getName()+","+customer.getBalance()+"," + total+","+ submit );
}
}
if(entering.equals("submit"))
......@@ -370,8 +397,7 @@ static class Repository{
if(order.getID() == IdOfOrder)
order.setStatus("submitted");
}
//todo if we submit we must decrease the repositry
// which repositry to decrease >>??
}
if(submit.equals("discount"))
{
......@@ -386,7 +412,8 @@ static class Repository{
}
}
}}
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