# TUT07 b. DRYKISS
Code Review: [tutorial repo - drykiss file](https://nw-syd-gitlab.cseunsw.tech/z5295293/tutorials-24t2/-/blob/master/tut07/b.drykiss/drykiss.ts?ref_type=heads)
---
## GROUP AERO
### New Code
```js
import promptSync from 'prompt-sync';
/**
* Given an array of n integers, caclulate the minimum, maximum, and the
* product of the first n-1 numbers and last n-1 numbers.
*/
function promptres(prompt,text: string) {
return parseInt(prompt(text));
}
function drykiss(myList: number[]) {
let myMin = Infinity;
myMin = math.min(number);
// for (let i = 0; i < myList.length; i++) {
// if (myList[i] < myMin) {
// myMin = myList[i];
// }
}
let myMax = -Infinity;
myMax = math.max(numer)
// for (let i = 0; i < myList.length; i++) {
// if (myList[i] > myMax) {
// myMax = myList[i];
// }
// }
let prod = 1;
for (let i = 0; i < 4; i++) {
prod = prod * myList[i];
}
const prodHead = prod;
prod = 1;
for (let i = 1; i < 5; i++) {
prod = prod * myList[i];
}
const result = [myMin, myMax, prodHead, prod];
return result;
}
const prompt = promptSync();
const a = parseInt(prompt('Enter a: '));
const b = parseInt(prompt('Enter b: '));
const c = parseInt(prompt('Enter c: '));
const d = parseInt(prompt('Enter d: '));
const e = parseInt(prompt('Enter e: '));
const myList = [a, b, c, d, e];
const result = drykiss(myList);
console.log('Minimum:');
console.log(`${result[0]}`);
console.log('Maximum:');
console.log(`${result[1]}`);
console.log('Product of first 4 numbers:');
console.log(`${result[2]}`);
console.log('Product of last 4 numbers');
console.log(`${result[3]}`);
```
---
## GROUP BOOST
### New Code
```js
// Write code here!!
import promptSync from 'prompt-sync';
/**
* Given an array of n integers, caclulate the minimum, maximum, and the
* product of the first n-1 numbers and last n-1 numbers.
*/
function drykiss(myList: number[]) {
if (myList.length === 0) return NULL;
let myMin = Infinity;
for (let i = 0; i < myList.length; i++) {
if (myList[i] < myMin) {
myMin = myList[i];
}
}
let myMax = -Infinity;
for (let i = 0; i < myList.length; i++) {
if (myList[i] > myMax) {
myMax = myList[i];
}
}
let prod = 1;
for (let i = 0; i < 4; i++) {
prod = prod * myList[i];
}
const prodHead = prod;
prod = 1;
for (let i = 1; i < 5; i++) {
prod = prod * myList[i];
}
const result = [myMin, myMax, prodHead, prod];
return result;
}
const prompt = promptSync();
const a = parseInt(prompt('Enter a: '));
const b = parseInt(prompt('Enter b: '));
const c = parseInt(prompt('Enter c: '));
const d = parseInt(prompt('Enter d: '));
const e = parseInt(prompt('Enter e: '));
const myList = [a, b, c, d, e];
const result = drykiss(myList);
console.log('Minimum:');
console.log(`${result[0]}`);
console.log('Maximum:');
console.log(`${result[1]}`);
console.log('Product of first 4 numbers:');
console.log(`${result[2]}`);
console.log('Product of last 4 numbers');
console.log(`${result[3]}`);
```
---
## GROUP DREAM
### New Code
```js
// Write code here!!
import promptSync from 'prompt-sync';
/**
* Given an array of n integers, caclulate the minimum, maximum, and the
* product of the first n-1 numbers and last n-1 numbers.
*/
function drykiss(myList: number[]) {
let myMin = Infinity;
for (let i = 0; i < myList.length; i++) {
if (myList[i] < myMin) {
myMin = myList[i];
}
}
let myMax = -Infinity;
for (let i = 0; i < myList.length; i++) {
if (myList[i] > myMax) {
myMax = myList[i];
}
}
let prod = 1;
for (let i = 0; i < 4; i++) {
prod = prod * myList[i];
}
const prodHead = prod;
prod = 1;
for (let i = 1; i < 5; i++) {
prod = prod * myList[i];
}
const result = [myMin, myMax, prodHead, prod];
return result;
}
const prompt = promptSync();
const a = parseInt(prompt('Enter a: '));
const b = parseInt(prompt('Enter b: '));
const c = parseInt(prompt('Enter c: '));
const d = parseInt(prompt('Enter d: '));
const e = parseInt(prompt('Enter e: '));
const myList = [a, b, c, d, e];
const result = drykiss(myList);
console.log('Minimum:');
console.log(`${result[0]}`);
console.log('Maximum:');
console.log(`${result[1]}`);
console.log('Product of first 4 numbers:');
console.log(`${result[2]}`);
console.log('Product of last 4 numbers');
console.log(`${result[3]}`);
```
---
## GROUP EGGS
### New Code
```js
// Write code here!!
// :)
import promptSync from 'prompt-sync';
/**
* Given an array of n integers, caclulate the minimum, maximum, and the
* product of the first n-1 numbers and last n-1 numbers.
*/
function drykiss(myList: number[]) {
let myMin = Infinity;
myMin = myList.filter((num) => num < myMin)[myList.filter((num) => num < myMin).length - 1]
for (let i = 0; i < myList.length; i++) {
if (myList[i] < myMin) {
myMin = myList[i];
}
}
let myMax = -Infinity;
for (let i = 0; i < myList.length; i++) {
if (myList[i] > myMax) {
myMax = myList[i];
}
}
let prod = 1;
for (let i = 0; i < 4; i++) {
prod = prod * myList[i];
}
const prodHead = prod;
prod = 1;
for (let i = 1; i < 5; i++) {
prod = prod * myList[i];
}
return [myMin, myMax, prodHead, prod];
}
const prompt = promptSync();
const a = parseInt(prompt('Enter a: '));
const b = parseInt(prompt('Enter b: '));
const c = parseInt(prompt('Enter c: '));
const d = parseInt(prompt('Enter d: '));
const e = parseInt(prompt('Enter e: '));
const myList = [a, b, c, d, e];
const result = drykiss(myList);
console.log('Minimum:');
console.log(`${result[0]}`);
console.log('Maximum:');
console.log(`${result[1]}`);
console.log('Product of first 4 numbers:');
console.log(`${result[2]}`);
console.log('Product of last 4 numbers');
console.log(`${result[3]}`);
```
---