Hi Team
I need some help with my requirement to implement coin jar in c# using rest api. My requirement are as below;
"coin jar only accept latest us coinage, must have volume of 42 fluids ounces"
"must have a counter to keep track of the total amount of money collected"
"reset the count back to $0.00."
My logic so far is as follows in c# using rest api
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Net.Http;
- using System.Web.Http;
- namespace CoinJarAPI.Controllers
- {
- public class CoinJarController : ApiController
- {
- // GET: api/CoinJar
- public IEnumerable<string> Get()
- {
- return new string[] { "value1", "value2" };
- }
- // GET: api/CoinJar/5
- public string Get(int id)
- {
- return "value";
- }
- // POST: api/CoinJar
- public void Post([FromBody]string value)
- {
- }
- // PUT: api/CoinJar/5
- public void Put(int id, [FromBody]string value)
- {
- }
- // DELETE: api/CoinJar/5
- public void Delete(int id)
- {
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CoinJarAPI.Interface
- {
- interface ICoinJar
- {
- void AddCoin(ICoin coin);
- decimal GetTotalAmount();
- void Reset();
- }
- public interface ICoin
- {
- decimal Amount { get; set; }
- decimal Volume { get; set; }
- }
- }
- using CoinJarAPI.Interface;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace CoinJarAPI.Repository
- {
- public class Repository : ICoinJar
- {
- public void AddCoin(ICoin coin)
- {
- throw new NotImplementedException();
- }
- public decimal GetTotalAmount()
- {
- throw new NotImplementedException();
- }
- public void Reset()
- {
- throw new NotImplementedException();
- }
- }
- }
Mario ScheerenPosted Oct 16, 2020, 10:22 AM
Guest UserPosted Oct 19, 2020, 4:17 AM
Mario ScheerenPosted Oct 19, 2020, 4:05 AM
Guest UserPosted Oct 17, 2020, 3:32 AM
Guest UserPosted Oct 14, 2020, 8:05 AM
Mario ScheerenPosted Oct 14, 2020, 8:01 AM