Commit 2bb09d82 authored by chris.crook's avatar chris.crook

> bigboi generations

parent 25849d59
......@@ -5,6 +5,7 @@ import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
......@@ -45,6 +46,40 @@ public class BuyScreen extends AppCompatActivity {
}
public void YouWillPayForWhatYouHaveDone (View view){
// do they have the money?
String tempinopit = ((EditText) findViewById(R.id.yeetus)).getText().toString();
if(tempinopit.equals("")){
// no value entered
return;
}
double priceinput;
priceinput = Double.parseDouble(((EditText) findViewById(R.id.yeetus)).getText().toString());
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
String temp = "";
try{
Scanner reader = new Scanner(file5);
while (reader.hasNextLine()){
temp = temp + reader.nextLine();
}
} catch(Exception e){ }
String [] passed = temp.split("&"); //id number,full_receipt,price(£)
if (Double.parseDouble(passed [2]) <= priceinput){
// enough money was given
String ihateyou = (priceinput - Double.parseDouble(passed[2]) + "");
((EditText) findViewById(R.id.yeetus)).setText(ihateyou);
passed [2] = "0";
// passed [0] = "Payment Complete";
((TextView)findViewById(R.id.textView36)).setText("Payment Complete");
((TextView)findViewById(R.id.textView37)).setText("Price to pay: £" + passed [2] + ", all transactions are made in GBP.");
}
else{
// u too poor
((EditText) findViewById(R.id.yeetus)).setText("");
Toast.makeText(getApplicationContext(), "You need more money", Toast.LENGTH_SHORT).show();
return;
}
// clear things and go back
String filename6 = "Booking";
File file6;
file6 = new File(getApplicationContext().getFilesDir(), filename6 + ".txt");
......@@ -71,7 +106,7 @@ public class BuyScreen extends AppCompatActivity {
} catch(Exception e){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,CheckoutScreen.class);
startActivity(intent);
// Intent intent = new Intent(this,CheckoutScreen.class);
// startActivity(intent);
}
}
\ No newline at end of file
......@@ -45,5 +45,13 @@
android:text="Pay"
app:rippleColor="#0f0" />
<EditText
android:id="@+id/yeetus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="enter money"
android:inputType="textPersonName" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -69,14 +69,14 @@
<ImageView
android:id="@+id/imageView12"
android:layout_width="wrap_content"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button55"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="Lbook"
......@@ -90,18 +90,18 @@
<ImageView
android:id="@+id/imageView7"
android:layout_width="wrap_content"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button50"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="NMOCbook"
android:text="NMOC" />
android:text="National Museum Of China" />
</LinearLayout>
<LinearLayout
......@@ -111,18 +111,18 @@
<ImageView
android:id="@+id/imageView8"
android:layout_width="wrap_content"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button51"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="VMbook"
android:text="VM" />
android:text="Vatican Museums" />
</LinearLayout>
<LinearLayout
......@@ -132,18 +132,18 @@
<ImageView
android:id="@+id/imageView9"
android:layout_width="wrap_content"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button52"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="MMOAbook"
android:text="MMOA" />
android:text="Metropolitan Museum Of Art" />
</LinearLayout>
<LinearLayout
......@@ -153,18 +153,18 @@
<ImageView
android:id="@+id/imageView10"
android:layout_width="wrap_content"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button53"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="BMbook"
android:text="BM" />
android:text="British Museum" />
</LinearLayout>
<LinearLayout
......@@ -174,18 +174,18 @@
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button44"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="TMbook"
android:text="TM" />
android:text="Tate Modern" />
</LinearLayout>
<LinearLayout
......@@ -195,18 +195,18 @@
<ImageView
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button45"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="NGbook"
android:text="NG" />
android:text="National Gallery" />
</LinearLayout>
<LinearLayout
......@@ -237,18 +237,18 @@
<ImageView
android:id="@+id/imageView5"
android:layout_width="wrap_content"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button47"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="NHMbook"
android:text="NHM" />
android:text="Natural History Museum" />
</LinearLayout>
<LinearLayout
......@@ -258,18 +258,18 @@
<ImageView
android:id="@+id/imageView6"
android:layout_width="wrap_content"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button49"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="AMONHbook"
android:text="AMONH" />
android:text="American Museum Of Natural History" />
</LinearLayout>
<LinearLayout
......@@ -279,18 +279,18 @@
<ImageView
android:id="@+id/miv1"
android:layout_width="wrap_content"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/mb1"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="SHMbook"
android:text="SHM" />
android:text="State Hermatige Museum" />
</LinearLayout>
<LinearLayout
......@@ -317,12 +317,12 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="232dp"
android:orientation="horizontal">
<Button
android:id="@+id/button61"
android:layout_width="match_parent"
android:layout_width="210dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:onClick="tocart"
......
......@@ -369,14 +369,14 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="53dp"
android:layout_height="150dp"
android:orientation="horizontal"
android:translationY="-115px">
android:translationY="-350px">
<Button
android:id="@+id/button99"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:onClick="tocart"
android:text="Cart"
......@@ -385,7 +385,7 @@
<Button
android:id="@+id/button100"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:onClick="tobooking"
android:text="Booking"
......
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