Skip to content

week-3-homework-2-damla-unal created by GitHub Classroom

Notifications You must be signed in to change notification settings

damla-unal/go-structs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

week-3-homework-2

  • Please study Ch07 of GoPL book.
  • Create a rectangle abstraction using struct. Create two functions to calculate area and circumference of given rectangle instance and set produced values on given rectangle instance. Create another function to create an instance of rectangle struct and return it. But that function would be able to return an error in case of passing invalid arguments such as negative length or height. Choose one of strategies mentioned i the text book and exemplified in error.go of ch 05 in example project.
  • Implement a number-guessing game in which the computer computes a four digit number as a secret number and a player tries to guess that number correctly. Player would enter her guess and the computer would produce a feedback on the positions of the digits. Four-digit number can't start with 0 and have repeating digits. Let's say the computer computes 2658 as a secret number to be guessed by the player. When player enters her guess such as 1234, the computer would display -1 meaning that only one digit of 1234 exist in the secret number and its position is wrong. When the player enters 5678 the similarly the computer displays +2-1. And the game goes on until the player correctly guess the secret number and the computer displays +4. The game also keeps track of all guesses entered by the players so far and lists them when it displays its feedback to the player so that the player can compute her next guess correctly.
  • Try to understand and run examples in following chapters of the repo https://github.com/inancgumus/learngo Chapters 22,24 and 25.

Do not forget to commit the initial and final work.

About

week-3-homework-2-damla-unal created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%