Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CarRental_Christopher_Foster
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
christopher.foster
CarRental_Christopher_Foster
Commits
b4f8f212
Commit
b4f8f212
authored
May 17, 2020
by
christopher.foster
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Final product
parent
0a4a6166
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
297 additions
and
18 deletions
+297
-18
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+2
-1
orderDetails.java
app/src/main/java/com/example/assignment/orderDetails.java
+10
-17
reciept.java
app/src/main/java/com/example/assignment/reciept.java
+87
-0
activity_reciept.xml
app/src/main/res/layout/activity_reciept.xml
+198
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
b4f8f212
...
@@ -9,7 +9,8 @@
...
@@ -9,7 +9,8 @@
android:roundIcon=
"@mipmap/ic_launcher_round"
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme"
>
android:theme=
"@style/AppTheme"
>
<activity
android:name=
".reviewToy"
></activity>
<activity
android:name=
".reciept"
></activity>
<activity
android:name=
".reviewToy"
/>
<activity
android:name=
".reviewBenz"
/>
<activity
android:name=
".reviewBenz"
/>
<activity
android:name=
".reviewHon"
/>
<activity
android:name=
".reviewHon"
/>
<activity
android:name=
".reviewJag"
/>
<activity
android:name=
".reviewJag"
/>
...
...
app/src/main/java/com/example/assignment/orderDetails.java
View file @
b4f8f212
...
@@ -13,13 +13,15 @@ import java.util.Random;
...
@@ -13,13 +13,15 @@ import java.util.Random;
public
class
orderDetails
extends
AppCompatActivity
{
public
class
orderDetails
extends
AppCompatActivity
{
public
double
refreshment
=
0
;
public
double
refreshment
=
0
;
public
String
refresh
=
""
;
public
static
String
refresh
=
""
;
private
boolean
disc
=
false
;
private
boolean
disc
=
false
;
public
int
discount
=
0
;
public
static
int
discount
=
0
;
private
int
hours
=
0
;
private
int
hours
=
0
;
private
int
refreshNo
=
0
;
private
int
refreshNo
=
0
;
public
double
total
=
0
;
public
static
double
total
=
0
;
public
String
cost
=
""
;
public
static
String
cost
=
""
;
public
static
double
carCost
=
0
;
public
static
double
refreshCost
=
0
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
...
@@ -69,18 +71,8 @@ public class orderDetails extends AppCompatActivity {
...
@@ -69,18 +71,8 @@ public class orderDetails extends AppCompatActivity {
}
}
public
void
calculateCost
(
View
v
)
public
void
calculateCost
(
View
v
)
{
{
//EditText car = (EditText) findViewById(R.id.carChoice);
/*
EditText editText=findViewById(R.id.editText);
String temp=editText.getText().toString();
int value=0;
if (!“”.equals(temp)){
value=Integer.parseInt(temp);
}
*/
EditText
hour
=
(
EditText
)
findViewById
(
R
.
id
.
hours
);
EditText
hour
=
(
EditText
)
findViewById
(
R
.
id
.
hours
);
String
temp
=
hour
.
getText
().
toString
();
String
temp
=
hour
.
getText
().
toString
();
if
(!
""
.
equals
(
temp
))
if
(!
""
.
equals
(
temp
))
...
@@ -123,15 +115,16 @@ if (!“”.equals(temp)){
...
@@ -123,15 +115,16 @@ if (!“”.equals(temp)){
break
;
break
;
}
}
carCost
=
total
;
refreshCost
=
(
refreshment
*
refreshNo
);
total
=
total
+
(
refreshment
*
refreshNo
);
total
=
total
+
(
refreshment
*
refreshNo
);
total
=
total
-((
total
/
100
)*
discount
);
total
=
total
-((
total
/
100
)*
discount
);
cost
=
Double
.
toString
(
total
);
cost
=
Double
.
toString
(
total
);
Toast
.
makeText
(
getApplicationContext
(),
"Cost"
+
cost
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
getApplicationContext
(),
"Cost"
+
cost
,
Toast
.
LENGTH_LONG
).
show
();
Intent
list
=
new
Intent
(
this
,
Carlis
t
.
class
);
Intent
reciept
=
new
Intent
(
this
,
reciep
t
.
class
);
startActivity
(
lis
t
);
startActivity
(
reciep
t
);
}
}
...
...
app/src/main/java/com/example/assignment/reciept.java
0 → 100644
View file @
b4f8f212
package
com
.
example
.
assignment
;
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
;
public
class
reciept
extends
AppCompatActivity
{
private
double
payment
=
0
;
private
double
change
=
0
;
private
boolean
paid
=
false
;
private
String
moneyBack
=
"0"
;
private
String
refCost
=
"0"
;
private
String
discount
=
"0"
;
private
String
carCost
=
"0"
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_reciept
);
TextView
total
=
(
TextView
)
findViewById
(
R
.
id
.
totalCost
);
total
.
setText
(
orderDetails
.
cost
);
carCost
=
Double
.
toString
(
orderDetails
.
carCost
);
TextView
cost
=
(
TextView
)
findViewById
(
R
.
id
.
carCost
);
cost
.
setText
(
carCost
);
refCost
=
Double
.
toString
(
orderDetails
.
refreshCost
);
TextView
refresh
=
(
TextView
)
findViewById
(
R
.
id
.
refreshCost
);
refresh
.
setText
(
refCost
);
discount
=
Integer
.
toString
(
orderDetails
.
discount
);
TextView
disc
=
(
TextView
)
findViewById
(
R
.
id
.
percentage
);
disc
.
setText
(
discount
);
TextView
refreshment
=
(
TextView
)
findViewById
(
R
.
id
.
refreshReciept
);
refreshment
.
setText
(
orderDetails
.
refresh
);
TextView
car
=
(
TextView
)
findViewById
(
R
.
id
.
receiptCar
);
car
.
setText
(
carPurchase
.
choice
);
}
public
void
payment
(
View
v
)
{
EditText
pay
=
(
EditText
)
findViewById
(
R
.
id
.
pay
);
String
temp
=
pay
.
getText
().
toString
();
if
(!
""
.
equals
(
temp
))
{
payment
=
Double
.
parseDouble
(
temp
);
}
if
(
payment
<
orderDetails
.
total
)
{
Toast
.
makeText
(
getApplicationContext
(),
"Please enter the full amount or more"
,
Toast
.
LENGTH_LONG
).
show
();
}
else
{
change
=
payment
-
orderDetails
.
total
;
moneyBack
=
Double
.
toString
(
change
);
TextView
Change
=
(
TextView
)
findViewById
(
R
.
id
.
change
);
Change
.
setText
(
moneyBack
);
paid
=
true
;
}
}
public
void
carList
(
View
v
)
{
if
(
paid
)
{
Intent
I
=
new
Intent
(
this
,
Carlist
.
class
);
startActivity
(
I
);
}
else
{
Toast
.
makeText
(
getApplicationContext
(),
"Please pay fisrt"
,
Toast
.
LENGTH_LONG
).
show
();
}
}
}
app/src/main/res/layout/activity_reciept.xml
0 → 100644
View file @
b4f8f212
<?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=
".reciept"
>
<TextView
android:id=
"@+id/textView40"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"130dp"
android:layout_marginLeft=
"130dp"
android:layout_marginTop=
"20dp"
android:text=
"Reciept"
android:textColor=
"#000"
android:textSize=
"40sp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/receiptCar"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"40dp"
android:layout_marginLeft=
"40dp"
android:layout_marginTop=
"30dp"
android:text=
"placeholder"
android:textColor=
"#000"
android:textSize=
"20sp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/textView40"
/>
<TextView
android:id=
"@+id/carCost"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"30dp"
android:layout_marginEnd=
"40dp"
android:layout_marginRight=
"40dp"
android:text=
"cost"
android:textColor=
"#000"
android:textSize=
"20sp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/textView40"
/>
<TextView
android:id=
"@+id/refreshReciept"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"40dp"
android:layout_marginLeft=
"40dp"
android:layout_marginTop=
"20dp"
android:text=
"Placeholder"
android:textColor=
"#000"
android:textSize=
"20sp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/receiptCar"
/>
<TextView
android:id=
"@+id/refreshCost"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:layout_marginEnd=
"40dp"
android:layout_marginRight=
"40dp"
android:text=
"cost"
android:textColor=
"#000"
android:textSize=
"20sp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/carCost"
/>
<TextView
android:id=
"@+id/textView45"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"40dp"
android:layout_marginLeft=
"40dp"
android:layout_marginTop=
"20dp"
android:text=
"Discount"
android:textColor=
"#000"
android:textSize=
"20sp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/refreshReciept"
/>
<TextView
android:id=
"@+id/textView46"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"40dp"
android:layout_marginLeft=
"40dp"
android:layout_marginTop=
"20dp"
android:text=
"Total"
android:textColor=
"#000"
android:textSize=
"20sp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/textView45"
/>
<Button
android:id=
"@+id/carListbtn"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"161dp"
android:layout_marginRight=
"161dp"
android:layout_marginBottom=
"180dp"
android:onClick=
"carList"
android:text=
"carList"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
/>
<TextView
android:id=
"@+id/percentage"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:layout_marginEnd=
"40dp"
android:layout_marginRight=
"40dp"
android:text=
"cost"
android:textColor=
"#000"
android:textSize=
"20sp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/refreshCost"
/>
<TextView
android:id=
"@+id/totalCost"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:layout_marginEnd=
"40dp"
android:layout_marginRight=
"40dp"
android:text=
"cost"
android:textColor=
"#000"
android:textSize=
"20sp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/percentage"
/>
<TextView
android:id=
"@+id/textView49"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"75dp"
android:layout_marginLeft=
"75dp"
android:layout_marginTop=
"20dp"
android:text=
"Payment"
android:textColor=
"#000"
android:textSize=
"20sp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/textView46"
/>
<TextView
android:id=
"@+id/textView50"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"83dp"
android:layout_marginLeft=
"83dp"
android:layout_marginTop=
"19dp"
android:text=
"Change"
android:textColor=
"#000"
android:textSize=
"20sp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/pay"
/>
<TextView
android:id=
"@+id/change"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"84dp"
android:layout_marginLeft=
"84dp"
android:layout_marginTop=
"17dp"
android:text=
"0"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/textView50"
/>
<Button
android:id=
"@+id/payment"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"52dp"
android:layout_marginEnd=
"36dp"
android:layout_marginRight=
"36dp"
android:onClick=
"payment"
android:text=
"Pay"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/totalCost"
/>
<EditText
android:id=
"@+id/pay"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginLeft=
"16dp"
android:layout_marginTop=
"8dp"
android:ems=
"10"
android:inputType=
"numberDecimal"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/textView49"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment