Commit 167907f9 authored by chris.crook's avatar chris.crook

> big boi IV (the voyage home)

parent df0d01ea
......@@ -9,7 +9,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Summative_Chris_Crook">
<activity android:name=".ShopDetails"></activity>
<activity android:name=".BuyScreen"></activity>
<activity android:name=".ShopDetails" />
<activity android:name=".CheckoutScreen" />
<activity android:name=".BookingDetails" />
<activity android:name=".PasswordSettings" />
......
package com.example.summative_chris_crook;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import java.io.File;
import java.io.FileWriter;
import java.util.Scanner;
public class BuyScreen extends AppCompatActivity {
String filename5 = "pass";
File file5;
Double Euro = 1.16;
Double USD = 1.40;
Double HKD = 10.85;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_buy_screen);
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(£)
((TextView)findViewById(R.id.textView36)).setText("Booking number: " + passed [0]);
((TextView)findViewById(R.id.textView37)).setText("Price to pay: £" + passed [2] + ", all transactions are made in GBP.");
}
public void goback (View view){
Intent intent = new Intent(this,CheckoutScreen.class);
startActivity(intent);
}
public void YouWillPayForWhatYouHaveDone (View view){
String filename6 = "Booking";
File file6;
file6 = new File(getApplicationContext().getFilesDir(), filename6 + ".txt");
try{
FileWriter stream = new FileWriter(file6, false);
stream.append("");
stream.close();
//Toast.makeText(getApplicationContext(), "Cart contents wiped", Toast.LENGTH_LONG).show();
} catch(Exception e){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
String filename7 = "ItemShop";
File file7;
file7 = new File(getApplicationContext().getFilesDir(), filename7 + ".txt");
try{
FileWriter stream = new FileWriter(file7, false);
stream.append("");
stream.close();
//Toast.makeText(getApplicationContext(), "Cart contents wiped", Toast.LENGTH_LONG).show();
} catch(Exception e){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,CheckoutScreen.class);
startActivity(intent);
}
}
\ No newline at end of file
......@@ -64,10 +64,21 @@ public class CheckoutScreen extends AppCompatActivity {
//
}
String [] passed = temp.split("&"); // id,name,city,country,price
String filename7 = "ItemShop";// + passed[1] + passed[0];
File file7;
file7 = new File(getApplicationContext().getFilesDir(), filename7 + ".txt");
String read = "";
try {
Scanner reader = new Scanner(file7);
while (reader.hasNextLine()) {
read = read + reader.nextLine();
}
} catch (Exception e) { }
String filename6 = "Booking";// + passed[1] + passed[0];
File file6;
file6 = new File(getApplicationContext().getFilesDir(), filename6 + ".txt");
String read = "";
String items = read;
read = "";
try {
Scanner reader = new Scanner(file6);
while (reader.hasNextLine()) {
......@@ -82,6 +93,7 @@ public class CheckoutScreen extends AppCompatActivity {
int totalprice = 0;
int idint2 = (int) Math.round(Math.random() * (999999 - 100000 + 1) + 100000);
String [] loadbooking = read.split("&");
String [] loaditems = items.split("&");
String bookingoutput = "Cart ID: " + idint2 + "\nBookings made:\n>";
for (int i = 0; i < loadbooking.length; i++){
if (i%12 == 1){
......@@ -152,6 +164,76 @@ public class CheckoutScreen extends AppCompatActivity {
}
bookingoutput += "\n\nOther Items:\n>";
for (int i = 0; i < loaditems.length; i++){
if (i%12 == 1){
//museum name
bookingoutput += loaditems [i];
bookingoutput += ", ";
}
if (i%12 == 2){
//city
// bookingoutput += "(";
// bookingoutput += loaditems [i];
// bookingoutput += "), ";
}
if (i%12 == 9){
//currency mode to select
}
if (i%12 == 4){
//price
totalprice += Integer.parseInt(loaditems[i]);
bookingoutput += " ";
String pricetest = loaditems [i+4];
if (temploadarray[3].equals("£")){
bookingoutput += "£";
bookingoutput += loaditems[i];
}
if (temploadarray[3].equals("€")){
bookingoutput += "€";
double price = Double.parseDouble(loaditems[i]);
price *= Euro;
bookingoutput += price;
bookingoutput += "(£";
bookingoutput += loaditems[i];
bookingoutput += ")";
}
if (temploadarray[3].equals("US$")){
bookingoutput += "$";
double price = Double.parseDouble(loaditems[i]);
price *= USD;
bookingoutput += price;
bookingoutput += "(£";
bookingoutput += loaditems[i];
bookingoutput += ")";
}
if (temploadarray[3].equals("HK$")){
bookingoutput += "$";
double price = Double.parseDouble(loaditems[i]);
price *= HKD;
bookingoutput += price;
bookingoutput += "(£";
bookingoutput += loaditems[i];
bookingoutput += ")";
}
double price = 0;
//bookingoutput += loadbooking [i];
bookingoutput += ", ";
}
if (i%12 == 11){
//time slot
bookingoutput += loaditems [i];
bookingoutput += ", ";
}
if (i%12 == 0){
//end of each booking entry
//bookingoutput += loadbooking [i];
bookingoutput += "\n";
bookingoutput += "> ";
}
}
//bookingoutput += items;
bookingoutput += "\n\nTotal: ";
if (temploadarray[3].equals("£")){
bookingoutput += "£";
......@@ -190,6 +272,7 @@ public class CheckoutScreen extends AppCompatActivity {
bookingoutput += " All Prices Billed in GBP (£)";
((EditText)findViewById(R.id.outputcheckout)).setText(bookingoutput);
((EditText)findViewById(R.id.YEET4)).setText(idint2 + "&" + bookingoutput + "&" + totalprice);
}
public void gobackfromtheshop (View view){
......@@ -245,6 +328,19 @@ public class CheckoutScreen extends AppCompatActivity {
Toast.makeText(getApplicationContext(), "Cart contents wiped", Toast.LENGTH_LONG).show();
} catch(Exception e){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
String filename7 = "ItemShop";
File file7;
file7 = new File(getApplicationContext().getFilesDir(), filename7 + ".txt");
try{
FileWriter stream = new FileWriter(file7, false);
stream.append("");
stream.close();
//Toast.makeText(getApplicationContext(), "Cart contents wiped", Toast.LENGTH_LONG).show();
} catch(Exception e){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
......@@ -254,5 +350,18 @@ public class CheckoutScreen extends AppCompatActivity {
public void ChaChing (View view){
//buy
String writetofile = ((EditText) findViewById(R.id.YEET4)).getText().toString();
String filename5 = "pass"; // passthrough file (temp storage until overwritten)
File file5;
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
try {
FileWriter stream = new FileWriter(file5, false);
stream.append(writetofile);
stream.close();
} catch(Exception f){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,BuyScreen.class);
startActivity(intent);
}
}
\ No newline at end of file
......@@ -234,6 +234,32 @@ public class MainActivity extends AppCompatActivity {
} catch(Exception e){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
String filename6 = "Booking";
File file6;
file6 = new File(getApplicationContext().getFilesDir(), filename6 + ".txt");
try{
FileWriter stream = new FileWriter(file6, false);
stream.append("");
stream.close();
//Toast.makeText(getApplicationContext(), "Cart contents wiped", Toast.LENGTH_LONG).show();
} catch(Exception e){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
String filename7 = "ItemShop";
File file7;
file7 = new File(getApplicationContext().getFilesDir(), filename7 + ".txt");
try{
FileWriter stream = new FileWriter(file7, false);
stream.append("");
stream.close();
//Toast.makeText(getApplicationContext(), "Cart contents wiped", Toast.LENGTH_LONG).show();
} catch(Exception e){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,AdminMenu.class);
startActivity(intent);
return;
......@@ -250,6 +276,32 @@ public class MainActivity extends AppCompatActivity {
} catch(Exception e){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
String filename6 = "Booking";
File file6;
file6 = new File(getApplicationContext().getFilesDir(), filename6 + ".txt");
try{
FileWriter stream = new FileWriter(file6, false);
stream.append("");
stream.close();
//Toast.makeText(getApplicationContext(), "Cart contents wiped", Toast.LENGTH_LONG).show();
} catch(Exception e){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
String filename7 = "ItemShop";
File file7;
file7 = new File(getApplicationContext().getFilesDir(), filename7 + ".txt");
try{
FileWriter stream = new FileWriter(file7, false);
stream.append("");
stream.close();
//Toast.makeText(getApplicationContext(), "Cart contents wiped", Toast.LENGTH_LONG).show();
} catch(Exception e){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,AdminMenu.class);
startActivity(intent);
return;
......@@ -265,6 +317,32 @@ public class MainActivity extends AppCompatActivity {
} catch(Exception e){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
String filename6 = "Booking";
File file6;
file6 = new File(getApplicationContext().getFilesDir(), filename6 + ".txt");
try{
FileWriter stream = new FileWriter(file6, false);
stream.append("");
stream.close();
//Toast.makeText(getApplicationContext(), "Cart contents wiped", Toast.LENGTH_LONG).show();
} catch(Exception e){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
String filename7 = "ItemShop";
File file7;
file7 = new File(getApplicationContext().getFilesDir(), filename7 + ".txt");
try{
FileWriter stream = new FileWriter(file7, false);
stream.append("");
stream.close();
//Toast.makeText(getApplicationContext(), "Cart contents wiped", Toast.LENGTH_LONG).show();
} catch(Exception e){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,UserMenu.class);
startActivity(intent);
return;
......
......@@ -97,6 +97,16 @@ public class MainShopPage extends AppCompatActivity {
}
}
public void tobooking (View view){
Intent intent = new Intent(this,MainBookingPage.class);
startActivity(intent);
}
public void tocart (View view){
Intent intent = new Intent(this,CheckoutScreen.class);
startActivity(intent);
}
public String openandload(){
try{
Scanner reader = new Scanner(file1);
......@@ -113,14 +123,242 @@ public class MainShopPage extends AppCompatActivity {
return "&&&";
}
}
// generic function to copy and paste whithin this page
public void item1 (View view){
String filename5 = "pass"; // passthrough file (temp storage until overwritten)
File file5;
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
try {
FileWriter stream = new FileWriter(file5, false);
stream.append("00&T-shirts&_&_&10"); // write format: id,item_name,blank,blank,price
stream.close();
} catch(Exception f){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,ShopDetails.class);
startActivity(intent);
}
// giftshop items
public void TShirt (View view){
String filename5 = "pass";
File file5;
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
try {
FileWriter stream = new FileWriter(file5, false);
stream.append("01&T-shirts&_&_&10");
stream.close();
} catch(Exception f){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,ShopDetails.class);
startActivity(intent);
}
public void Hat (View view){
String filename5 = "pass";
File file5;
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
try {
FileWriter stream = new FileWriter(file5, false);
stream.append("02&Hats&_&_&5");
stream.close();
} catch(Exception f){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,ShopDetails.class);
startActivity(intent);
}
public void SnowGlobe (View view){
String filename5 = "pass";
File file5;
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
try {
FileWriter stream = new FileWriter(file5, false);
stream.append("03&Snow Globe&_&_&5");
stream.close();
} catch(Exception f){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,ShopDetails.class);
startActivity(intent);
}
public void KeyRing (View view){
String filename5 = "pass";
File file5;
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
try {
FileWriter stream = new FileWriter(file5, false);
stream.append("04&Key Rings&_&_&5");
stream.close();
} catch(Exception f){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,ShopDetails.class);
startActivity(intent);
}
public void Bottle (View view){
String filename5 = "pass";
File file5;
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
try {
FileWriter stream = new FileWriter(file5, false);
stream.append("05&Bottles&_&_&5");
stream.close();
} catch(Exception f){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,ShopDetails.class);
startActivity(intent);
}
public void Mug (View view){
String filename5 = "pass";
File file5;
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
try {
FileWriter stream = new FileWriter(file5, false);
stream.append("06&Mugs&_&_&5");
stream.close();
} catch(Exception f){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,ShopDetails.class);
startActivity(intent);
}
public void Coaster (View view){
String filename5 = "pass";
File file5;
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
try {
FileWriter stream = new FileWriter(file5, false);
stream.append("07&Coasters&_&_&2");
stream.close();
} catch(Exception f){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,ShopDetails.class);
startActivity(intent);
}
// cafe items
public void Tea (View view){
String filename5 = "pass";
File file5;
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
try {
FileWriter stream = new FileWriter(file5, false);
stream.append("01&Tea&_&_&1");
stream.close();
} catch(Exception f){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,ShopDetails.class);
startActivity(intent);
}
public void Water (View view){
String filename5 = "pass";
File file5;
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
try {
FileWriter stream = new FileWriter(file5, false);
stream.append("02&Water&_&_&1");
stream.close();
} catch(Exception f){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,ShopDetails.class);
startActivity(intent);
}
public void Coffee (View view){
String filename5 = "pass";
File file5;
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
try {
FileWriter stream = new FileWriter(file5, false);
stream.append("03&Coffee&_&_&2");
stream.close();
} catch(Exception f){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,ShopDetails.class);
startActivity(intent);
}
public void Flatbread (View view){
String filename5 = "pass";
File file5;
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
try {
FileWriter stream = new FileWriter(file5, false);
stream.append("04&Flatbread&_&_&2");
stream.close();
} catch(Exception f){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,ShopDetails.class);
startActivity(intent);
}
public void Sandvich (View view){
String filename5 = "pass";
File file5;
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
try {
FileWriter stream = new FileWriter(file5, false);
stream.append("05&T-Sandwich&_&_&2");
stream.close();
} catch(Exception f){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,ShopDetails.class);
startActivity(intent);
}
public void Sweetroll (View view){
String filename5 = "pass";
File file5;
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
try {
FileWriter stream = new FileWriter(file5, false);
stream.append("06&Sweet Roll&_&_&2");
stream.close();
} catch(Exception f){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,ShopDetails.class);
startActivity(intent);
}
public void Salad (View view){
String filename5 = "pass";
File file5;
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
try {
FileWriter stream = new FileWriter(file5, false);
stream.append("02&T-shirts&_&_&10");
stream.append("07&Salad&_&_&2");
stream.close();
} catch(Exception f){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
......
......@@ -11,6 +11,7 @@ import android.widget.TextView;
import android.widget.Toast;
import java.io.File;
import java.io.FileWriter;
import java.util.Scanner;
public class ShopDetails extends AppCompatActivity {
......@@ -62,35 +63,395 @@ public class ShopDetails extends AppCompatActivity {
String passedtitle = passed [1];
if (temploadarray [9].equals("ENG")){
title = "Booking for: " + passedtitle;
title = "Purchace details: " + passedtitle;
String price = "Price: ";
((TextView)findViewById(R.id.textView29)).setText(title);
((Button)findViewById(R.id.button83)).setText("Back");
}
else if (temploadarray [9].equals("FRA")){
title = "Réservation pour: " + passedtitle;
title = ": " + passedtitle;
String price = "Price: ";
((TextView)findViewById(R.id.textView29)).setText(title);
((Button)findViewById(R.id.button83)).setText("de retour");
}
else if (temploadarray [9].equals("ESP")){
title = "Reserva para: " + passedtitle;
title = ": " + passedtitle;
String price = "Price: ";
((TextView)findViewById(R.id.textView29)).setText(title);
((Button)findViewById(R.id.button83)).setText("espalda");
}
else if (temploadarray [9].equals("DEU")){
title = "Buchung für: " + passedtitle;
title = ": " + passedtitle;
String price = "Price: ";
((TextView)findViewById(R.id.textView29)).setText(title);
((Button)findViewById(R.id.button83)).setText("rückseite");
}
else{
title = "Booking for: (not ENG) " + passedtitle;
String price = "Price: ";
((TextView)findViewById(R.id.textView29)).setText(title);
((Button)findViewById(R.id.button83)).setText("Back");
}
((EditText)findViewById(R.id.YEET3)).setText(temp);
// temploadarray[] contains: id,item_name,_,_,price,name,password,adminflag,currency,language,id
String price = "Price: ";
// if (passed [4].equals("£")){
// price += "£";
// }
// if (passed [4].equals("€")){
// price += "€";
// }
// if (passed [4].equals("£")){
// price += "£";
// }
// if (passed [4].equals("£")){
// price += "£";
// }
price += temploadarray [8];
if (temploadarray [8].equals("£")){
price += temploadarray [4];
}
else{
double priceboog = Double.parseDouble(temploadarray [4]);
if (temploadarray [8].equals("€")){
priceboog *= Euro;
priceboog = Math.round(priceboog * 100.0) / 100.0;
price += priceboog + " (£";
price += temploadarray [4];
price += ")";
}
if (temploadarray [8].equals("US$")){
priceboog *= USD;
priceboog = Math.round(priceboog * 100.0) / 100.0;
price += priceboog + " (£";
price += temploadarray [4];
price += ")";
}
if (temploadarray [8].equals("HK$")){
priceboog *= HKD;
priceboog = Math.round(priceboog * 100.0) / 100.0;
price += priceboog + " (£";
price += temploadarray [4];
price += ")";
}
}
((TextView)findViewById(R.id.textView33)).setText(price);
}
public void goback (View view){
Intent intent = new Intent(this,MainShopPage.class);
startActivity(intent);
}
public void loovie (View view) {
String tempwrite = ((EditText) findViewById(R.id.YEET3)).getText().toString();
tempwrite += "&Louvre";
String[] temploadarray = tempwrite.split("&");
// id,item_name,_,_,price,name,password,adminflag,currency,language,id
String filename7 = "ItemShop";
File file7;
file7 = new File(getApplicationContext().getFilesDir(), filename7 + ".txt");
String temp = "";
try {
Scanner reader = new Scanner(file7);
while (reader.hasNextLine()) {
temp = temp + reader.nextLine();
}
} catch (Exception e) {
}
if (temp.equals("")) {
//
} else {
tempwrite = "&" + tempwrite;
}
try {
FileWriter stream = new FileWriter(file7, true);
stream.append(tempwrite);
stream.close();
Toast.makeText(getApplicationContext(), "Purchase made", Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
}
public void NMOC (View view){
String tempwrite = ((EditText) findViewById(R.id.YEET3)).getText().toString();
tempwrite += "&National Museum of China";
String[] temploadarray = tempwrite.split("&");
// id,item_name,_,_,price,name,password,adminflag,currency,language,id
String filename7 = "ItemShop";
File file7;
file7 = new File(getApplicationContext().getFilesDir(), filename7 + ".txt");
String temp = "";
try {
Scanner reader = new Scanner(file7);
while (reader.hasNextLine()) {
temp = temp + reader.nextLine();
}
} catch (Exception e) {
}
if (temp.equals("")) {
//
} else {
tempwrite = "&" + tempwrite;
}
try {
FileWriter stream = new FileWriter(file7, true);
stream.append(tempwrite);
stream.close();
Toast.makeText(getApplicationContext(), "Purchase made", Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
}
public void VM (View view){
String tempwrite = ((EditText) findViewById(R.id.YEET3)).getText().toString();
tempwrite += "&Vatican Museums";
String[] temploadarray = tempwrite.split("&");
// id,item_name,_,_,price,name,password,adminflag,currency,language,id
String filename7 = "ItemShop";
File file7;
file7 = new File(getApplicationContext().getFilesDir(), filename7 + ".txt");
String temp = "";
try {
Scanner reader = new Scanner(file7);
while (reader.hasNextLine()) {
temp = temp + reader.nextLine();
}
} catch (Exception e) {
}
if (temp.equals("")) {
//
} else {
tempwrite = "&" + tempwrite;
}
try {
FileWriter stream = new FileWriter(file7, true);
stream.append(tempwrite);
stream.close();
Toast.makeText(getApplicationContext(), "Purchase made", Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
}
public void MMOA (View view){
String tempwrite = ((EditText) findViewById(R.id.YEET3)).getText().toString();
tempwrite += "&Metropolitan Museum of Art";
String[] temploadarray = tempwrite.split("&");
// id,item_name,_,_,price,name,password,adminflag,currency,language,id
String filename7 = "ItemShop";
File file7;
file7 = new File(getApplicationContext().getFilesDir(), filename7 + ".txt");
String temp = "";
try {
Scanner reader = new Scanner(file7);
while (reader.hasNextLine()) {
temp = temp + reader.nextLine();
}
} catch (Exception e) {
}
if (temp.equals("")) {
//
} else {
tempwrite = "&" + tempwrite;
}
try {
FileWriter stream = new FileWriter(file7, true);
stream.append(tempwrite);
stream.close();
Toast.makeText(getApplicationContext(), "Purchase made", Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
}
public void BM (View view){
String tempwrite = ((EditText) findViewById(R.id.YEET3)).getText().toString();
tempwrite += "&British Museum";
String[] temploadarray = tempwrite.split("&");
// id,item_name,_,_,price,name,password,adminflag,currency,language,id
String filename7 = "ItemShop";
File file7;
file7 = new File(getApplicationContext().getFilesDir(), filename7 + ".txt");
String temp = "";
try {
Scanner reader = new Scanner(file7);
while (reader.hasNextLine()) {
temp = temp + reader.nextLine();
}
} catch (Exception e) {
}
if (temp.equals("")) {
//
} else {
tempwrite = "&" + tempwrite;
}
try {
FileWriter stream = new FileWriter(file7, true);
stream.append(tempwrite);
stream.close();
Toast.makeText(getApplicationContext(), "Purchase made", Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
}
public void TM (View view){
String tempwrite = ((EditText) findViewById(R.id.YEET3)).getText().toString();
tempwrite += "&Tate Modern";
String[] temploadarray = tempwrite.split("&");
// id,item_name,_,_,price,name,password,adminflag,currency,language,id
String filename7 = "ItemShop";
File file7;
file7 = new File(getApplicationContext().getFilesDir(), filename7 + ".txt");
String temp = "";
try {
Scanner reader = new Scanner(file7);
while (reader.hasNextLine()) {
temp = temp + reader.nextLine();
}
} catch (Exception e) {
}
if (temp.equals("")) {
//
} else {
tempwrite = "&" + tempwrite;
}
try {
FileWriter stream = new FileWriter(file7, true);
stream.append(tempwrite);
stream.close();
Toast.makeText(getApplicationContext(), "Purchase made", Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
}
public void NG (View view){
String tempwrite = ((EditText) findViewById(R.id.YEET3)).getText().toString();
tempwrite += "&National Gallery";
String[] temploadarray = tempwrite.split("&");
// id,item_name,_,_,price,name,password,adminflag,currency,language,id
String filename7 = "ItemShop";
File file7;
file7 = new File(getApplicationContext().getFilesDir(), filename7 + ".txt");
String temp = "";
try {
Scanner reader = new Scanner(file7);
while (reader.hasNextLine()) {
temp = temp + reader.nextLine();
}
} catch (Exception e) {
}
if (temp.equals("")) {
//
} else {
tempwrite = "&" + tempwrite;
}
try {
FileWriter stream = new FileWriter(file7, true);
stream.append(tempwrite);
stream.close();
Toast.makeText(getApplicationContext(), "Purchase made", Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
}
public void NHM (View view){
String tempwrite = ((EditText) findViewById(R.id.YEET3)).getText().toString();
tempwrite += "&Natural History Museum";
String[] temploadarray = tempwrite.split("&");
// id,item_name,_,_,price,name,password,adminflag,currency,language,id
String filename7 = "ItemShop";
File file7;
file7 = new File(getApplicationContext().getFilesDir(), filename7 + ".txt");
String temp = "";
try {
Scanner reader = new Scanner(file7);
while (reader.hasNextLine()) {
temp = temp + reader.nextLine();
}
} catch (Exception e) {
}
if (temp.equals("")) {
//
} else {
tempwrite = "&" + tempwrite;
}
try {
FileWriter stream = new FileWriter(file7, true);
stream.append(tempwrite);
stream.close();
Toast.makeText(getApplicationContext(), "Purchase made", Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
}
public void AMONH (View view){
String tempwrite = ((EditText) findViewById(R.id.YEET3)).getText().toString();
tempwrite += "&American Museum of Natural History";
String[] temploadarray = tempwrite.split("&");
// id,item_name,_,_,price,name,password,adminflag,currency,language,id
String filename7 = "ItemShop";
File file7;
file7 = new File(getApplicationContext().getFilesDir(), filename7 + ".txt");
String temp = "";
try {
Scanner reader = new Scanner(file7);
while (reader.hasNextLine()) {
temp = temp + reader.nextLine();
}
} catch (Exception e) {
}
if (temp.equals("")) {
//
} else {
tempwrite = "&" + tempwrite;
}
try {
FileWriter stream = new FileWriter(file7, true);
stream.append(tempwrite);
stream.close();
Toast.makeText(getApplicationContext(), "Purchase made", Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
}
public void SHM (View view){
String tempwrite = ((EditText) findViewById(R.id.YEET3)).getText().toString();
tempwrite += "&State Hermitage Museum";
String[] temploadarray = tempwrite.split("&");
// id,item_name,_,_,price,name,password,adminflag,currency,language,id
String filename7 = "ItemShop";
File file7;
file7 = new File(getApplicationContext().getFilesDir(), filename7 + ".txt");
String temp = "";
try {
Scanner reader = new Scanner(file7);
while (reader.hasNextLine()) {
temp = temp + reader.nextLine();
}
} catch (Exception e) {
}
if (temp.equals("")) {
//
} else {
tempwrite = "&" + tempwrite;
}
try {
FileWriter stream = new FileWriter(file7, true);
stream.append(tempwrite);
stream.close();
Toast.makeText(getApplicationContext(), "Purchase made", Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
}
}
\ No newline at end of file
......@@ -122,15 +122,15 @@
<TextView
android:id="@+id/textView28"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_weight="1"
android:text="Default Currency" />
android:text="Default Currency (Display only, transactions handled in GBP)" />
<EditText
android:id="@+id/WOAH"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0px"
android:ems="10"
android:inputType="textPersonName"
android:text="ENG" />
......@@ -138,15 +138,16 @@
<EditText
android:id="@+id/currencyStore"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0px"
android:ems="10"
android:inputType="textPersonName"
android:text="£" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="222dp"
android:orientation="horizontal">
android:layout_height="wrap_content"
android:orientation="horizontal"
android:translationY="-100dp">
<Button
android:id="@+id/button77"
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".BuyScreen">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/textView35"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Payment" />
<Button
android:id="@+id/button111"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Back" />
<TextView
android:id="@+id/textView36"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView" />
<TextView
android:id="@+id/textView37"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView" />
<Button
android:id="@+id/button112"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="YouWillPayForWhatYouHaveDone"
android:text="Pay" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -58,8 +58,21 @@
<EditText
android:id="@+id/outputcheckout"
android:layout_width="match_parent"
android:layout_height="429dp"
android:layout_height="408dp"
android:clickable="false"
android:editable="false"
android:ems="10"
android:inputType="textLongMessage|textMultiLine" />
<Space
android:layout_width="match_parent"
android:layout_height="match_parent" />
<EditText
android:id="@+id/YEET4"
android:layout_width="match_parent"
android:layout_height="0px"
android:ems="10"
android:inputType="textPersonName" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -53,7 +53,7 @@
<Button
android:id="@+id/button10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0px"
android:onClick="ohhshiiiiii"
android:text="Button" />
......
......@@ -210,7 +210,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="0px"
android:orientation="horizontal">
<ImageView
......
......@@ -53,6 +53,12 @@
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/textView31"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -70,7 +76,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="item1"
android:onClick="TShirt"
android:text="T-shirt" />
</LinearLayout>
......@@ -91,7 +97,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button" />
android:onClick="Hat"
android:text="Hat" />
</LinearLayout>
<LinearLayout
......@@ -111,7 +118,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button" />
android:onClick="SnowGlobe"
android:text="Globe" />
</LinearLayout>
<LinearLayout
......@@ -131,7 +139,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button" />
android:onClick="KeyRing"
android:text="KeyRing"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
......@@ -151,11 +161,234 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button" />
android:onClick="Bottle"
android:text="Bottle" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button90"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="Mug"
android:text="Mug" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button91"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="Coaster"
android:text="Coaster"
android:textSize="11sp" />
</LinearLayout>
<TextView
android:id="@+id/textView32"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Refreshments" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button92"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="Tea"
android:text="Tea" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button93"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="Water"
android:text="Water" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button94"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="Coffee"
android:text="Coffee" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button95"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="Flatbread"
android:text="FlatBread"
android:textSize="9sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button96"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="Sandvich"
android:text="Sandvich"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView24"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button97"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="Sweetroll"
android:text="Sweet Roll"
android:textSize="9sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView25"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button98"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="Salad"
android:text="Salad" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="53dp"
android:orientation="horizontal"
android:translationY="-115px">
<Button
android:id="@+id/button99"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="tocart"
android:text="Button" />
<Button
android:id="@+id/button100"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="tobooking"
android:text="Button" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -24,12 +24,94 @@
android:onClick="goback"
android:text="Button" />
<TextView
android:id="@+id/textView33"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Price:" />
<TextView
android:id="@+id/textView34"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Select alocation to pick up:" />
<EditText
android:id="@+id/YEET3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0px"
android:ems="10"
android:inputType="textPersonName"
android:text="Name" />
<Button
android:id="@+id/button101"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="loovie"
android:text="Louvre" />
<Button
android:id="@+id/button102"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="NMOC"
android:text="National Museum Of China" />
<Button
android:id="@+id/button103"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="VM"
android:text="Vatican Museums" />
<Button
android:id="@+id/button104"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="MMOA"
android:text="Metropolitan Museum Of Art" />
<Button
android:id="@+id/button105"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="BM"
android:text="British Museum" />
<Button
android:id="@+id/button106"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="TM"
android:text="Tate Modern" />
<Button
android:id="@+id/button107"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="NG"
android:text="National Gallery" />
<Button
android:id="@+id/button108"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="NHM"
android:text="Natural History Museum" />
<Button
android:id="@+id/button109"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="AMONH"
android:text="American Museum Of Natural History" />
<Button
android:id="@+id/button110"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="SHM"
android:text="State Hermatige Museum" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
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