Starter Project

The problem

Develop a combination of a web service and an Android application that implements a simple "quote of the day" system.

When the user starts the Android application it will display the quote of the day. The activity will have two buttons that will allow users to upvote or downvote the quotes.

The database

Inside the Spring Boot starter project I have provided you will find a database folder with datebase files. Use the MySQL workbench to create a new schema named 'qod' and then use the data import tools to import the database files from the database folder.

The qod database has two tables.

The quotes table stores the quotations.

FieldTypeDescription
idINTInteger identifier, auto-incremented
dayDATEWhat day the quote should be displayed
quoteVARCHAR(128)The quotation

The votes table stores votes for the quotes.

FieldTypeDescription
quoteINTThe id number of the quote this vote is for
voteINT1 for an upvote, -1 for a downvote

The web service

The web service will have two controllers, one for quotes and one for votes. The quotes controller will support just one action, a GET that fetches today's quote. The votes controller will have just one action, a POST to post a new vote.

To select the quote for today's date you can use the SQL code

select * from quotes where day = curdate()

The Android application

The Android application will have just one activity. When the activity starts up it will set up a GET request to fetch the quote of the day and then display that quote.

When the user clicks one of the buttons, the activity will post a vote to the web service. You should add logic to activity that ignores button presses as soon as the user has voted so that the user can not vote more than once.