SlideShare a Scribd company logo
1 of 1
Download to read offline
here is my code so far but I cant get it to run properly because I keep getting an error code saying
75:14 Kotlin: Expecting ')' import java.io.File class Weather(val date: String, val precipitation:
Float, val snowfall: Float, val snowDepth: Float, val maxTemperature: Float, val
minTemperature: Float, val avgTemperature: Float, val heatingDegreeDays: Float, val
coolingDegreeDays: Float, val sunrise: String, val sunset: String, val lengthOfDay: String) fun
readData(): Map { val weatherDB = mutableMapOf () val lines =
File("weather.db").readLines().drop(1) for (line in lines) { val row = line.split(",") val date =
row[0] val precipitation = row[1].toFloat() val snowfall = row[2].toFloat() val snowDepth =
row[3].toFloat() val maxTemperature = row[4].toFloat() val minTemperature = row[5].toFloat()
val avgTemperature = row[6].toFloat() val heatingDegreeDays = row[7].toFloat() val
coolingDegreeDays = row[8].toFloat() val sunrise = row[9] val sunset = row[10] val
lengthOfDay = row[11] val key = getKey(date) weatherDB[key] = Weather(date, precipitation,
snowfall, snowDepth, maxTemperature, minTemperature, avgTemperature, heatingDegreeDays,
coolingDegreeDays, sunrise, sunset, lengthOfDay) } return weatherDB } fun getKey(date:
String): String { val (month, day) = date.split("/") return "${month.padStart(2,
'0')}/${day.padStart(2, '0')}" } fun printHeader() { println("%-10s%-15s%-10s%-10s%-10s%-
10s%-10s%-10s%-10s%-10s%-10s%-15s".format( "Date", "Precipitation", "Snowfall", "Snow
Depth", "Max Temp.", "Min Temp.", "Avg Temp.", "HDD", "CDD", "Sunrise", "Sunset",
"Length of Day")) } fun printAllRecords(weatherDB: Map ) { printHeader() for ((_, weather) in
weatherDB) { println("%-10s%-15.2f%-10.2f%-10.2f%-10.2f%-10.2f%-10.2f%-10.2f%-10.2f%-
10s%-10s%-15s".format( weather.date, weather.precipitation, weather.snowfall,
weather.snowDepth, weather.maxTemperature, weather.minTemperature,
weather.avgTemperature, weather.heatingDegreeDays, weather.coolingDegreeDays,
weather.sunrise, weather.sunset, weather.lengthOfDay)) } } fun
printRecordsFromSingleMonth(weatherDB: Map ) { printHeader() print("Enter month (MM): ")
val month = readLine()!!.padStart(2, '0') for ((key, weather) in weatherDB) { if
(key.startsWith(month)) { println(message = "%-10s%-15.2f%-10.2f%-10.2f%-10.2f%-10.2f%-
10.2f%-10.2f%-10.2f%-10s%-10s%-15s".format( weather.date, weather.precipitation,
weather.snowfall, weather.snowDepth, weather.maxTemperature, weather.minTemperature,
weather.avgTemperature, weather ) }

More Related Content

Similar to here is my code so far but I cant get it to run properly because I kee.pdf

Similar to here is my code so far but I cant get it to run properly because I kee.pdf (20)

InfluxDB IOx Tech Talks: A Rusty Introduction to Apache Arrow and How it App...
InfluxDB IOx Tech Talks:  A Rusty Introduction to Apache Arrow and How it App...InfluxDB IOx Tech Talks:  A Rusty Introduction to Apache Arrow and How it App...
InfluxDB IOx Tech Talks: A Rusty Introduction to Apache Arrow and How it App...
 
Node.js - As a networking tool
Node.js - As a networking toolNode.js - As a networking tool
Node.js - As a networking tool
 
The Ring programming language version 1.2 book - Part 26 of 84
The Ring programming language version 1.2 book - Part 26 of 84The Ring programming language version 1.2 book - Part 26 of 84
The Ring programming language version 1.2 book - Part 26 of 84
 
alexnet.pdf
alexnet.pdfalexnet.pdf
alexnet.pdf
 
Swift Ready for Production?
Swift Ready for Production?Swift Ready for Production?
Swift Ready for Production?
 
Flying Futures at the same sky can make the sun rise at midnight
Flying Futures at the same sky can make the sun rise at midnightFlying Futures at the same sky can make the sun rise at midnight
Flying Futures at the same sky can make the sun rise at midnight
 
Ns network simulator
Ns network simulatorNs network simulator
Ns network simulator
 
Griffon @ Svwjug
Griffon @ SvwjugGriffon @ Svwjug
Griffon @ Svwjug
 
The Ring programming language version 1.5.1 book - Part 35 of 180
The Ring programming language version 1.5.1 book - Part 35 of 180The Ring programming language version 1.5.1 book - Part 35 of 180
The Ring programming language version 1.5.1 book - Part 35 of 180
 
ddd+scala
ddd+scaladdd+scala
ddd+scala
 
The Ring programming language version 1.9 book - Part 45 of 210
The Ring programming language version 1.9 book - Part 45 of 210The Ring programming language version 1.9 book - Part 45 of 210
The Ring programming language version 1.9 book - Part 45 of 210
 
Flux and InfluxDB 2.0 by Paul Dix
Flux and InfluxDB 2.0 by Paul DixFlux and InfluxDB 2.0 by Paul Dix
Flux and InfluxDB 2.0 by Paul Dix
 
From android/ java to swift (2)
From android/ java to swift (2)From android/ java to swift (2)
From android/ java to swift (2)
 
Meet Up - Spark Stream Processing + Kafka
Meet Up - Spark Stream Processing + KafkaMeet Up - Spark Stream Processing + Kafka
Meet Up - Spark Stream Processing + Kafka
 
All you need to know about the JavaScript event loop
All you need to know about the JavaScript event loopAll you need to know about the JavaScript event loop
All you need to know about the JavaScript event loop
 
The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196
 
CLIM Undergraduate Workshop: (Attachment) Performing Extreme Value Analysis (...
CLIM Undergraduate Workshop: (Attachment) Performing Extreme Value Analysis (...CLIM Undergraduate Workshop: (Attachment) Performing Extreme Value Analysis (...
CLIM Undergraduate Workshop: (Attachment) Performing Extreme Value Analysis (...
 
node.js and the AR.Drone: building a real-time dashboard using socket.io
node.js and the AR.Drone: building a real-time dashboard using socket.ionode.js and the AR.Drone: building a real-time dashboard using socket.io
node.js and the AR.Drone: building a real-time dashboard using socket.io
 
The Ring programming language version 1.8 book - Part 42 of 202
The Ring programming language version 1.8 book - Part 42 of 202The Ring programming language version 1.8 book - Part 42 of 202
The Ring programming language version 1.8 book - Part 42 of 202
 
Strategy Synthesis for Data-Aware Dynamic Systems with Multiple Actors
Strategy Synthesis for Data-Aware Dynamic Systems with Multiple ActorsStrategy Synthesis for Data-Aware Dynamic Systems with Multiple Actors
Strategy Synthesis for Data-Aware Dynamic Systems with Multiple Actors
 

More from trishulinoverseas1

Hi Expert- could you please type the answers to see better )micro cour.pdf
Hi Expert- could you please type the answers to see better )micro cour.pdfHi Expert- could you please type the answers to see better )micro cour.pdf
Hi Expert- could you please type the answers to see better )micro cour.pdf
trishulinoverseas1
 
Here is the game description- Here is the sample game- Goal- Your goal (1).pdf
Here is the game description- Here is the sample game- Goal- Your goal (1).pdfHere is the game description- Here is the sample game- Goal- Your goal (1).pdf
Here is the game description- Here is the sample game- Goal- Your goal (1).pdf
trishulinoverseas1
 
Homework for Day 1 Design and carry out a simulation to answer the fol.pdf
Homework for Day 1 Design and carry out a simulation to answer the fol.pdfHomework for Day 1 Design and carry out a simulation to answer the fol.pdf
Homework for Day 1 Design and carry out a simulation to answer the fol.pdf
trishulinoverseas1
 

More from trishulinoverseas1 (20)

Hi I need help with this problem thank you! Hi I need help with this p.pdf
Hi I need help with this problem thank you! Hi I need help with this p.pdfHi I need help with this problem thank you! Hi I need help with this p.pdf
Hi I need help with this problem thank you! Hi I need help with this p.pdf
 
hey guys do fill the t accounts out of it in the below screenshot att.pdf
hey guys  do fill the t accounts out of it in the below screenshot att.pdfhey guys  do fill the t accounts out of it in the below screenshot att.pdf
hey guys do fill the t accounts out of it in the below screenshot att.pdf
 
Hi Expert- could you please type the answers to see better )micro cour.pdf
Hi Expert- could you please type the answers to see better )micro cour.pdfHi Expert- could you please type the answers to see better )micro cour.pdf
Hi Expert- could you please type the answers to see better )micro cour.pdf
 
Hi Expert ! could you please type the answers to see better! microbio.pdf
Hi Expert !  could you please type the answers to see better! microbio.pdfHi Expert !  could you please type the answers to see better! microbio.pdf
Hi Expert ! could you please type the answers to see better! microbio.pdf
 
Hey- I am struggling with this question- please help Journal entrv wor.pdf
Hey- I am struggling with this question- please help Journal entrv wor.pdfHey- I am struggling with this question- please help Journal entrv wor.pdf
Hey- I am struggling with this question- please help Journal entrv wor.pdf
 
Hhiory and Fhoweal Labocatery Results Complete the diagram by draggin.pdf
Hhiory and Fhoweal Labocatery Results  Complete the diagram by draggin.pdfHhiory and Fhoweal Labocatery Results  Complete the diagram by draggin.pdf
Hhiory and Fhoweal Labocatery Results Complete the diagram by draggin.pdf
 
Here- for esample- HTTH represents the outcome that the first toss is.pdf
Here- for esample- HTTH represents the outcome that the first toss is.pdfHere- for esample- HTTH represents the outcome that the first toss is.pdf
Here- for esample- HTTH represents the outcome that the first toss is.pdf
 
Here are the errors associated with a particular forecast over the pas.pdf
Here are the errors associated with a particular forecast over the pas.pdfHere are the errors associated with a particular forecast over the pas.pdf
Here are the errors associated with a particular forecast over the pas.pdf
 
Here is an example of active- natural immunity- If you had chicken pox.pdf
Here is an example of active- natural immunity- If you had chicken pox.pdfHere is an example of active- natural immunity- If you had chicken pox.pdf
Here is an example of active- natural immunity- If you had chicken pox.pdf
 
Here is the game description- Here is the sample game- Goal- Your goal (1).pdf
Here is the game description- Here is the sample game- Goal- Your goal (1).pdfHere is the game description- Here is the sample game- Goal- Your goal (1).pdf
Here is the game description- Here is the sample game- Goal- Your goal (1).pdf
 
Here is a chart of the Nasdaq Composite- the world's main technology i.pdf
Here is a chart of the Nasdaq Composite- the world's main technology i.pdfHere is a chart of the Nasdaq Composite- the world's main technology i.pdf
Here is a chart of the Nasdaq Composite- the world's main technology i.pdf
 
Here are the alphas and the betas for Company A and Company B- Alpha i.pdf
Here are the alphas and the betas for Company A and Company B- Alpha i.pdfHere are the alphas and the betas for Company A and Company B- Alpha i.pdf
Here are the alphas and the betas for Company A and Company B- Alpha i.pdf
 
Homework for Day 1 Design and carry out a simulation to answer the fol.pdf
Homework for Day 1 Design and carry out a simulation to answer the fol.pdfHomework for Day 1 Design and carry out a simulation to answer the fol.pdf
Homework for Day 1 Design and carry out a simulation to answer the fol.pdf
 
Hot spots are used as a proof of P2T- the continent sliding over a sta.pdf
Hot spots are used as a proof of P2T- the continent sliding over a sta.pdfHot spots are used as a proof of P2T- the continent sliding over a sta.pdf
Hot spots are used as a proof of P2T- the continent sliding over a sta.pdf
 
Housing DataThe accompanying frequency distribution represents the own.pdf
Housing DataThe accompanying frequency distribution represents the own.pdfHousing DataThe accompanying frequency distribution represents the own.pdf
Housing DataThe accompanying frequency distribution represents the own.pdf
 
hotel BLU Vancouver what steps and progress has been achieved 6points.pdf
hotel BLU Vancouver what steps and progress has been achieved 6points.pdfhotel BLU Vancouver what steps and progress has been achieved 6points.pdf
hotel BLU Vancouver what steps and progress has been achieved 6points.pdf
 
Herb and Alice are married and file a joint return- Herb is 74 years o.pdf
Herb and Alice are married and file a joint return- Herb is 74 years o.pdfHerb and Alice are married and file a joint return- Herb is 74 years o.pdf
Herb and Alice are married and file a joint return- Herb is 74 years o.pdf
 
Homework E-1- Write a class for a School- Use a School object in the S.pdf
Homework E-1- Write a class for a School- Use a School object in the S.pdfHomework E-1- Write a class for a School- Use a School object in the S.pdf
Homework E-1- Write a class for a School- Use a School object in the S.pdf
 
Homework - Unanswered - Due Today- 4-45 PM assume 100 units of energy.pdf
Homework - Unanswered - Due Today- 4-45 PM assume 100 units of energy.pdfHomework - Unanswered - Due Today- 4-45 PM assume 100 units of energy.pdf
Homework - Unanswered - Due Today- 4-45 PM assume 100 units of energy.pdf
 
Home Insert Page Layout Formulas Data Review View HelpL34- 7 In cell M.pdf
Home Insert Page Layout Formulas Data Review View HelpL34- 7 In cell M.pdfHome Insert Page Layout Formulas Data Review View HelpL34- 7 In cell M.pdf
Home Insert Page Layout Formulas Data Review View HelpL34- 7 In cell M.pdf
 

Recently uploaded

會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
Krashi Coaching
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 

Recently uploaded (20)

會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
The Ball Poem- John Berryman_20240518_001617_0000.pptx
The Ball Poem- John Berryman_20240518_001617_0000.pptxThe Ball Poem- John Berryman_20240518_001617_0000.pptx
The Ball Poem- John Berryman_20240518_001617_0000.pptx
 
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptxREPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
 
Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024
 
II BIOSENSOR PRINCIPLE APPLICATIONS AND WORKING II
II BIOSENSOR PRINCIPLE APPLICATIONS AND WORKING IIII BIOSENSOR PRINCIPLE APPLICATIONS AND WORKING II
II BIOSENSOR PRINCIPLE APPLICATIONS AND WORKING II
 
philosophy and it's principles based on the life
philosophy and it's principles based on the lifephilosophy and it's principles based on the life
philosophy and it's principles based on the life
 
How to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryHow to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 Inventory
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
Navigating the Misinformation Minefield: The Role of Higher Education in the ...
Navigating the Misinformation Minefield: The Role of Higher Education in the ...Navigating the Misinformation Minefield: The Role of Higher Education in the ...
Navigating the Misinformation Minefield: The Role of Higher Education in the ...
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
....................Muslim-Law notes.pdf
....................Muslim-Law notes.pdf....................Muslim-Law notes.pdf
....................Muslim-Law notes.pdf
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 
IPL Online Quiz by Pragya; Question Set.
IPL Online Quiz by Pragya; Question Set.IPL Online Quiz by Pragya; Question Set.
IPL Online Quiz by Pragya; Question Set.
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/
 
“O BEIJO” EM ARTE .
“O BEIJO” EM ARTE                       .“O BEIJO” EM ARTE                       .
“O BEIJO” EM ARTE .
 

here is my code so far but I cant get it to run properly because I kee.pdf

  • 1. here is my code so far but I cant get it to run properly because I keep getting an error code saying 75:14 Kotlin: Expecting ')' import java.io.File class Weather(val date: String, val precipitation: Float, val snowfall: Float, val snowDepth: Float, val maxTemperature: Float, val minTemperature: Float, val avgTemperature: Float, val heatingDegreeDays: Float, val coolingDegreeDays: Float, val sunrise: String, val sunset: String, val lengthOfDay: String) fun readData(): Map { val weatherDB = mutableMapOf () val lines = File("weather.db").readLines().drop(1) for (line in lines) { val row = line.split(",") val date = row[0] val precipitation = row[1].toFloat() val snowfall = row[2].toFloat() val snowDepth = row[3].toFloat() val maxTemperature = row[4].toFloat() val minTemperature = row[5].toFloat() val avgTemperature = row[6].toFloat() val heatingDegreeDays = row[7].toFloat() val coolingDegreeDays = row[8].toFloat() val sunrise = row[9] val sunset = row[10] val lengthOfDay = row[11] val key = getKey(date) weatherDB[key] = Weather(date, precipitation, snowfall, snowDepth, maxTemperature, minTemperature, avgTemperature, heatingDegreeDays, coolingDegreeDays, sunrise, sunset, lengthOfDay) } return weatherDB } fun getKey(date: String): String { val (month, day) = date.split("/") return "${month.padStart(2, '0')}/${day.padStart(2, '0')}" } fun printHeader() { println("%-10s%-15s%-10s%-10s%-10s%- 10s%-10s%-10s%-10s%-10s%-10s%-15s".format( "Date", "Precipitation", "Snowfall", "Snow Depth", "Max Temp.", "Min Temp.", "Avg Temp.", "HDD", "CDD", "Sunrise", "Sunset", "Length of Day")) } fun printAllRecords(weatherDB: Map ) { printHeader() for ((_, weather) in weatherDB) { println("%-10s%-15.2f%-10.2f%-10.2f%-10.2f%-10.2f%-10.2f%-10.2f%-10.2f%- 10s%-10s%-15s".format( weather.date, weather.precipitation, weather.snowfall, weather.snowDepth, weather.maxTemperature, weather.minTemperature, weather.avgTemperature, weather.heatingDegreeDays, weather.coolingDegreeDays, weather.sunrise, weather.sunset, weather.lengthOfDay)) } } fun printRecordsFromSingleMonth(weatherDB: Map ) { printHeader() print("Enter month (MM): ") val month = readLine()!!.padStart(2, '0') for ((key, weather) in weatherDB) { if (key.startsWith(month)) { println(message = "%-10s%-15.2f%-10.2f%-10.2f%-10.2f%-10.2f%- 10.2f%-10.2f%-10.2f%-10s%-10s%-15s".format( weather.date, weather.precipitation, weather.snowfall, weather.snowDepth, weather.maxTemperature, weather.minTemperature, weather.avgTemperature, weather ) }