新的 Visual basic 程序员来了。试图让程序读取一个文本文件,但它似乎根本不起作用,没有错误消息或任何东西。它只是根本没有抓住价值
文本文件名完全相同。
Public Sub ReadDef()
Dim DefSR As IO.StreamReader = IO.File.OpenText("BikeDefault.txt")
GlobalTotBikes = DefSR.ReadLine()
GlobalRentRate = DefSR.ReadLine()
GlobalHSTRate = DefSR.ReadLine()
GlobalTourRate = DefSR.ReadLine()
GlobalGPSRate = DefSR.ReadLine()
GlobalInsurRate = DefSR.ReadLine()
GlobalWaterBotRate = DefSR.ReadLine()
GlobalNextBookNum = DefSR.ReadLine()
GlobalNextCustNum = DefSR.ReadLine()
GlobalNextInvoiceNum = DefSR.ReadLine()
DefSR.Close()
End Sub
Run Code Online (Sandbox Code Playgroud)
我已经将此代码与给出的示例进行了多次比较,但没有发现任何不同。
谢谢。
它达到了必须打印线的程度System.out.printf("%4s%22s%24s\n","Year"...)
,然后在没有打印的情况下停止.
public class WorldPopulationGrowth {
/**
* @param args
*/
public static void main(String[] args) {
Scanner input = new Scanner( System.in);
long BasePopulation; //The base, or current population
double GrowthRate; //The rate of increase
double GrowthResult; // The pop after growth rate increase
//Time to obtain the numbers needed for Calculation
//Specifically, the growth rate and the base population
System.out.println("Welcome to the world population calculator");
System.out.print("Enter the current world population:");
BasePopulation = input.nextLong();
System.out.println("Enter the current growth …
Run Code Online (Sandbox Code Playgroud) 为我正在制作的项目创建了这个程序,但我似乎无法弄清楚为什么它从未在结果中给出任何1.我在这里踢自己因为它可能很简单.
为了清楚起见:程序必须滚动两个单独的模具36k次并显示结果.
import java.util.Random; //Going to need this
public class Dicerolling { //Start Class
public static void main( String[] args)
{ //Start of Main
Random randomNumbers = new Random(); // Generates random numbers
int[] array = new int[ 13 ]; // Declares the array
int dice1 = 0;
int dice2;
int total;
//Roll the die 36,000 times
for ( int roll = 1; roll <=36000; roll++ )
dice1 = 1 + randomNumbers.nextInt ( 6 );
dice2 = 1 + randomNumbers.nextInt …
Run Code Online (Sandbox Code Playgroud)