From 0d8830d0a55a2ee50ba9d78673896abb4d920952 Mon Sep 17 00:00:00 2001 From: Ibrahim Mkusa Date: Wed, 26 Apr 2023 19:22:21 -0400 Subject: ex1.8 --- part1/unicafe/src/App.js | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/part1/unicafe/src/App.js b/part1/unicafe/src/App.js index 1b6f57e..4210f9c 100644 --- a/part1/unicafe/src/App.js +++ b/part1/unicafe/src/App.js @@ -14,6 +14,26 @@ const Display = (props) => { ) } +const Statistics = (props) => { + const good = props.good + const bad = props.bad + const neutral = props.neutral + const total = good + neutral + bad + + const average = (good - bad) / 9.0 + const positive_percent = (good/total) * 100 + return ( + <> + + + + + + + + ) +} + const App = () => { // save clicks of each button to its own state const [good, setGood] = useState(0) @@ -27,12 +47,7 @@ const App = () => {