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 ScheerenRank #1,371 · 1.2K reputationPosted Oct 16, 2020, 6:22 AM EDT
Mario ScheerenRank #1,371 · 1.2K reputationPosted Oct 14, 2020, 4:01 AM EDT
Guest UserRank #877 · 2.5K reputationPosted Oct 14, 2020, 4:05 AM EDT
Guest UserRank #877 · 2.5K reputationPosted Oct 16, 2020, 11:32 PM EDT
Mario ScheerenRank #1,371 · 1.2K reputationPosted Oct 19, 2020, 12:05 AM EDT
Guest UserRank #877 · 2.5K reputationPosted Oct 19, 2020, 12:17 AM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts