Exercise - Structs, Instances, and d Default Values une səni Imagine you are creating an app that will monitor location. Create a GPS struct with two variable properties, latitude and longitude, both Create a variable instance of GPS called somePlace. It should be initialized without supplying any arguments. Print out the latitude and longit be 0.0 for both.

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter2: Planning Applications And Designing Interfaces
Section: Chapter Questions
Problem 5E: Create an application that calculates and displays two raise amounts, which are based on an...
icon
Related questions
Question

How do I solve this using Swift code? 1 of 10

Exercise - Structs, Instances, and Default Values
Imagine you are creating an app that will monitor location. Create a GPS struct with two variable properties, latitude and longitude, both with default values of 0.0.
Create a variable instance of GPS called somePlace. It should be initialized without supplying any arguments. Print out the latitude and longitude of somePlace, which should
be 0.0 for both.
Change somePlace's latitude to 51.514004, and the longitude to 0.125226, then print the updated values.
Now imagine you are making a social app for sharing your favorite books. Create a Book struct with four variable properties: title, author, pages, and price. The default
values for both title and author should be an empty string. pages should default to 0, and price should default to 0.0.
Create a variable instance of Book called favoriteBook without supplying any arguments. Print out the title of favoriteBook. Does it currently reflect the title of your
favorite book? Probably not. Change all four properties of favoriteBook to reflect your favorite book. Then, using the properties of favoriteBook, print out facts about the
book.
Transcribed Image Text:Exercise - Structs, Instances, and Default Values Imagine you are creating an app that will monitor location. Create a GPS struct with two variable properties, latitude and longitude, both with default values of 0.0. Create a variable instance of GPS called somePlace. It should be initialized without supplying any arguments. Print out the latitude and longitude of somePlace, which should be 0.0 for both. Change somePlace's latitude to 51.514004, and the longitude to 0.125226, then print the updated values. Now imagine you are making a social app for sharing your favorite books. Create a Book struct with four variable properties: title, author, pages, and price. The default values for both title and author should be an empty string. pages should default to 0, and price should default to 0.0. Create a variable instance of Book called favoriteBook without supplying any arguments. Print out the title of favoriteBook. Does it currently reflect the title of your favorite book? Probably not. Change all four properties of favoriteBook to reflect your favorite book. Then, using the properties of favoriteBook, print out facts about the book.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Knowledge Booster
Running Time of Application
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,