Git Product home page Git Product logo

lab03's Introduction

Lab03

.NET Core

Challenge 1

Write a program that asks the user for 3 numbers. Return the product of these 3 numbers multiplied together. If the user puts in less than 3 numbers, return 0; If the user puts in more than 3 numbers, only multiply the first 3. If the number is not a number, default that value to 1.

  • Example:
The product of these 3 numbers is: 480
Hint: Consider using the split method
  • Tests:

    • Input a string of numbers and it returns a product of all numbers
    • Input more than 3 numbers
    • Input of less than 3 numbers
    • Can it handle negative numbers

Challenge 2

Create a method that asks the user to enter a number between 2-10. Then, prompt the user that number of times for random numbers.

After the user has inputted all of the numbers. Find the average of all the numbers inputted.

Specs: 1. Do not let the user put in negative numbers 2. Confirm each input is a real number

Example:


1 of 4 - Enter a number: 4
2 of 4 - Enter a number: 8
3 of 4 - Enter a number: 15
4 of 4 - Enter a number: 16
The average of these 4 numbers is: 10
  • Tests:

    • Input different ranges of numbers and confirm averages
    • Confirm input
    • All numbers are 0s

Challenge 3

Create a method that will output to the console the following design. Pay attention to spacing.

    * 
   *** 
  *****
 *******
*********
 *******
  *****
   ***
    * 
  • Tests:

    • No tests are required

Challenge 4

Write a method that brings in an integer array and returns the number that appears the most times. If there are no duplicates, return the first number in the array. If more than one number show up the same amount of time, return the first found.

 Example: Input: [1,1,2,2,3,3,3,1,1,5,5,6,7,8,2,1,1]
 output: 1
  • Tests:

    • Input different size arrays
    • All numbers in the array are the same value
    • No duplicates exist in the array
    • There multiple numbers that show up the same amount of times.

Challenge 5

Write a method in that finds the maximum value in the array. The array is not sorted. You may not use .Sort()

Example: input [5, 25, 99, 123, 78, 96, 555, 108, 4]
return: 555
  • Tests:
    • Negative numbers
    • All values are the same

Challenge 6

Write a method that asks the user to input a word, and then saves that word into an external file named words.txt

  • Hint: Have a file already saved in the root of your directory with a couple of words already present in the file.

  • Stretch:

    • Tests are optional for this challenge

Challenge 7

Write a method that reads the file in from Challenge 6, and outputs the contents to the console.

  • Stretch:
    • Tests are optional for this challenge

Challenge 8

Write a method that reads in the file from Challenge 6. Removes one of the words, and rewrites it back to the file.

  • Stretch:
    • Tests are optional for this challenge

Challenge 9

Write a method that asks the user to input a sentence and returns an array that with the word and the number of characters each word has:

  • Example:
Input: "This is a sentance about important things"
Output: ["this: 4","is: 2", "a: 1", "sentance: 8", "about: 5", "important: 9", "things: 6"]
  • Tests:
    • Input a sentance, and it returns the correct array
    • Inut a sentance and confirm it returns an array
    • Use different sentances with differnt symbols

lab03's People

Contributors

arikmackenburg avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.