Question

this is done i swift playgrounds, how to i go about doing this? confused how i would add to it since ita a constant "let"

Create a variable total of type Double set to 0. Then loop through the dictionary, and add the value of each integer and double to your variables value. For each string value, add 1 to the total. For each boolean add 2 to the total if the boolean is true, or subtract 3 if its false. Print the value of total. var total: Double - 0 44 for (key, value) in SomeDict 45 if value !nt { 46 47 48 49 total value Cannot assign to value: value is a let constant Binary operator+ cannot be applied to operands of type Double and Any Create a variable tota12 of type Double set to 0. Loop through the collection again, adding up all the ntegers anddoubles. For each strting that you come across during the loop, atempt to convert the string into a number, and add that value to the total. Ignore booleans. Print the total. 53 54 page 1 of 2 | Next: App Exercise - Workout Types

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The first error is generated as the command has been used inappropriately. Its hould be '==' intead of an '='. In the second error, the value is not getting added up to the variable total as it has been jsed inappropriately. It should be 'total=total + value' in order to add the value to the variable 'total'.

Add a comment
Know the answer?
Add Answer to:
this is done i swift playgrounds, how to i go about doing this? confused how i...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using Swift playground and / or the command line for macOS (open Xcode, create a new...

    Using Swift playground and / or the command line for macOS (open Xcode, create a new Xcode project, macOS, command line tool), practice the following exercises: Exercise: Swift Variables Declare 2 variables/constants with some random values and any name of your choice Considering these 2 variables, one as a value of PI and other as a radius of circle, find the area of circle Print the area of circle Declare a string variable explicitly with value “Northeastern”. Declare a string...

  • This is a java file and I am very confused on how to do this project!...

    This is a java file and I am very confused on how to do this project! please help!! Specifications Overview: You will write a program this week that is composed of three classes: the first class defines Ellipsoid objects, the second class defines EllipsoidList objects, and the third, Ellipsoid ListApp, reads in a file name entered by the user then reads the list name and Ellipsoid data from the file, creates Ellipsoid objects and stores them in an ArrayList of...

  • Write a simple Java program with the following naming structure: Open Eclipse Create a workspace called...

    Write a simple Java program with the following naming structure: Open Eclipse Create a workspace called hw1 Create a project called hw1 (make sure you select the “Use project folder as root for sources and class files”) Create a class called Hw1 in the hw1 package (make sure you check the box that auto creates the main method). Add a comment to the main that includes your name Write code that demonstrates the use of each of the following basic...

  • Develop a Generic String List (GSL). NOTE: I have done this lab but someting is wrong...

    Develop a Generic String List (GSL). NOTE: I have done this lab but someting is wrong here is what i was told that was needed. Ill provide my code at the very end. Here is what is missing : Here is my code: public class GSL { private String arr[]; private int size; public GSL() {     arr = new String[10];     size = 0; } public int size() {     return size; } public void add(String value) {    ...

  • i was able to make sense on the others but this two i need help Name:...

    i was able to make sense on the others but this two i need help Name: ImprovedQueue<T> Access Modifier: public Implements: QueueInterface<T> Instance variables Name: front Access modifier: private Data type: QueueNode<T> Constructors: Name: ImprovedQueue Access modifier: public Parameters: none (default constructor) Task: sets the value of front to null Methods Name: isEmpty Access modifier: public Parameters: none Return type: boolean Task: returns true if the front is equal to null; otherwise return false Name: dequeue                            Access modifier: public Parameters:...

  • COSC 1047-Final Exam- Winter 2019 games and action figures. public interface Inventoryitem I Retu...

    COSC 1047-Final Exam- Winter 2019 games and action figures. public interface Inventoryitem I Return the value of an item (quantity on public double getItemValue () 3 hand setall price)- Set the quantity of that iten in the stoce public void setQuantitylint qty) 7Return the inventory part number. public int getFartNumber o (6 marks) Assume that there are Comic, BoardGame and ActionFigure classes already written and that all thre implement Inventoryltem. Write statements to accomplish the following a. . Create an...

  • Hi, I am writing Java code and I am having a trouble working it out. The...

    Hi, I am writing Java code and I am having a trouble working it out. The instructions can be found below, and the code. Thanks. Instructions Here are the methods needed for CIS425_Student: Constructor: public CIS425_Student( String id, String name, int num_exams ) Create an int array exams[num_exams] which will hold all exam grades for a student Save num_exams for later error checking public boolean addGrade( int exam, int grade ) Save a grade in the exams[ ] array at...

  • Hello can someone help me in my code I left it as comment  task #0, task#1, task#2a...

    Hello can someone help me in my code I left it as comment  task #0, task#1, task#2a and task#2b the things that I am missing I'm using java domain class public class Pizza { private String pizzaCustomerName; private int pizzaSize; // 10, 12, 14, or 16 inches in diameter private char handThinDeep; // 'H' or 'T' or 'D' for hand tossed, thin crust, or deep dish, respecitively private boolean cheeseTopping; private boolean pepperoniTopping; private boolean sausageTopping; private boolean onionTopping; private boolean...

  • \\ this is the code i need help to get this part working the rest works...

    \\ this is the code i need help to get this part working the rest works but this and im not sure what is missing or how to make it work. this is what they asking for to do and there is two errors the ones shown in the pictures this is all the information I have from zybooks\\ Q3. (54 Points) Complete a public class to represent a Movie as described below. (a-e 4 pts each) (f-h 8 pts...

  • In Java. I am getting confused with this assignment, my confusion starts where I stopped. Create a package named tempera...

    In Java. I am getting confused with this assignment, my confusion starts where I stopped. Create a package named temperature and create a program that has a while loop. • Inside the while loop, your program will prompt the user for temperature in Centigrade. • If the Centigrade value read in is <= -100, the loop will exit. • Otherwise, your program will compute the Fahrenheit equivalent temperature. • Inside the while loop, your program will print out the Centigrade...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT